First of all, When I opened the link (http://gmail.com
) I found this page.
Before performing any actions you need to click
SIGN IN
button.
Element :
LinkText = Sign In
OR
LinkText = SIGN IN
OR
css = a[class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']
OR
xpath = //a[@class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']
Code should be like this from line num
38
:
wd.get(url);
wd.findElement(By.xpath("//a[@class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']")).click();
Thread.sleep(2000); // remove this after your code get run properly
WebElement loginName = wd.findElement(By.name("identifier"));
After clicking on
SIGN IN
, browser will open this page and you can run your remain code.