TestProject Forum
Powered by leading experts in the test automation community

Java Selenium - get page title

How can i verify a sequence of text from title tag using selenium WebDriver ?

Use JUnit, very friendly unit testing framework for Java.

[code]WebDriver driver = new FirefoxDriver();

String actual = driver.getTitle();
String expected = “title”;
assertTrue(actual.equalsIgnoreCase(expected));[/code]

create a JUnit test case class and wrap this code inside a test method with the @Test attribute.