0
package webdriver;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Gmail {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    WebDriver driver=new FirefoxDriver();
    driver.get("http://www.gmail.com");
    driver.findElement(By.id("Email")).sendKeys("[email protected]");
    driver.findElement(By.id("Next")).click();
    driver.findElement(By.id("Password")).sendKeys("welcome");
    driver.findElement(By.id("signIn")).click();


}

}


I got the following error. Please help me

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"Next"}
Command duration or timeout: 186 milliseconds
For documentation on this error, please visit:  http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
1
  • could you add the source of the element you are trying to find?
    – ECiurleo
    Jul 21, 2016 at 8:37

1 Answer 1

1

It means that Selenium was not able to find the locator that you have mentioned. Since the issue is on locator with id "Next", it is throwing exception at this point.

I just checked and the locator for this on Gmail page should be with id "next" because this is what the HTML shows

<input id="next" class="rc-button rc-button-submit" type="submit" value="Next" name="signIn"/>

Use "next" in the code for the id field and it should work.

Also I would recommend -try doing a little bit more of research before posting a question. This is one of the most basic issues faced with Selenium and you will have go your answer if you would've researched a bit- on the web or on this site as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.