In some instances, the getTitle() method does not work for me.
Take a look.
@Test
public void testTitleReliability() {
driver.get("https://www.google.com");
boolean title = driver.getTitle() == "Google";
if(title)
System.out.println("I am working correctly");
else if(!title)
System.out.println("I am broken!");
However, it will work with this:
@Test
public void testTitleReliability() {
driver.get("https://www.google.com");
boolean title = driver.getTitle().contains("Google");
if(title)
System.out.println("I am working correctly");
else if(!title)
System.out.println("I am broken!");
Anyone know why?