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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -