Java Selenium - get page title

  • 1 Replies
  • 1083 Views
Java Selenium - get page title
« on: March 09, 2016, 11:15:19 am »
How can i verify a sequence of text from title tag using selenium WebDriver ?

*

Oren

  • **
  • 59
Re: Java Selenium - get page title
« Reply #1 on: March 09, 2016, 18:19:14 pm »
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));

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

 

Sitemap 1 2 3 4 5 6 7 8