Gmail login fail using Selenium webdriver Showing element not found for password

0 votes
public static void main(String[] args){
    System.setProperty("webdriver.chrome.driver","E:/softwares/chromedriver_win32/chromedriver.exe");
    WebDriver gmail= new ChromeDriver();

    gmail.get("https://www.gmail.co.in"); 
    gmail.findElement(By.id("Email")).sendKeys("abcd");
    gmail.findElement(By.id("next")).click();
    gmail.findElement(By.id("Passwd")).sendKeys("xyz");
Dec 4, 2020 in Selenium by anonymous
• 10,480 points
465 views

1 answer to this question.

0 votes

Try setting an implicit wait of maybe 10 seconds.

gmail.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Or set an explicit wait. An explicit wait is a code you define to wait for a certain condition to occur before proceeding further in the code. In your case, it is the visibility of the password input field.

WebDriverWait wait = new WebDriverWait(gmail, 10);
WebElement element = wait.until(
    ExpectedConditions.visibilityOfElementLocated(By.id("Passwd")));
gmail.findElement(By.id("Passwd")).sendKeys("xyz");
answered Dec 4, 2020 by Gitika
• 65,970 points

Related Questions In Selenium

0 votes
1 answer

Using gettext() method for the specific element using Selenium WebDriver

Mistake is that u r printing the ...READ MORE

answered Apr 10, 2018 in Selenium by Vardy
• 2,360 points
26,843 views
+10 votes
17 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,360 points
151,650 views
0 votes
1 answer

Wait for an element to be accessible using Selenium WebDriver

You can try out the below code: ...READ MORE

answered May 18, 2018 in Selenium by Atul
• 10,230 points
683 views
0 votes
1 answer

Not able to login using selenium webdriver using Java Language

Try to send text to the username ...READ MORE

answered Jul 17, 2018 in Selenium by Samarpit
• 5,890 points
1,300 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
6,199 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
6,562 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
4,185 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
5,195 views
0 votes
1 answer

Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

You can use the document.evaluate: Evaluates an XPath ...READ MORE

answered Nov 27, 2020 in Selenium by Gitika
• 65,970 points
2,133 views
+3 votes
6 answers

Verifying whether an element present or visible in selenium Webdriver

Below code will help you: To check Element ...READ MORE

answered Apr 17, 2018 in Selenium by king_kenny
• 3,710 points
64,307 views