Error:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: #passwordNext
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'BRIGHTLEAF-0046', ip: '192.168.0.107', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 59.0.2, javascriptEnabled: true, moz:accessibilityChecks: false, moz:headless: false, moz:processID: 9752, moz:profile: C:\Users\Priti Raut\AppData..., moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: XP, platformName: XP, platformVersion: 10.0, rotatable: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: 7982cff0-6252-4eae-9a37-68aa3b6ef83e
*** Element info: {Using=id, value=passwordNext}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
Code:
package scripts;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class google
{
public static void main(String[] args)
{
System.setProperty("webdriver.gecko.driver","C:\\Users\\Priti Raut\\Downloads\\geckodriver-v0.20.1-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().deleteAllCookies();
driver.get("https://mail.google.com/");
driver.findElement(By.id("identifierId")).sendKeys("my username");
driver.findElement(By.id("identifierNext")).click();
System.out.println("identifier next");
//driver.findElement(By.name("password")).sendKeys("my password");
System.out.println("password next");
driver.findElement(By.id("passwordNext")).click();
System.out.println("click next");
driver.quit();
}
}
I tried using className as well as using name attribute, but system doesn't accept value for password and next button of password.