selenium webdriver - Unable to validate title of URL of a website -
i tried validate title of url, code have mentioned below show no error gave wrong output. please see code below:
public static void main(string[] args) { webdriver driver=new firefoxdriver(); driver.get("https://www.google.com"); string c; c = driver.gettitle(); if (c!="google") system.out.println("true"); driver.close(); }
why output true
. title of url google
https://stackoverflow.com/a/513839/366348
== tests reference equality (whether same object).
.equals() tests value equality (whether logically "equal").
so correct code if (!c.equals("google"))
Comments
Post a Comment