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

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

python - How to use Celery in Tornado with redis as broker and backend? -