Getting error while accessing the password field in gmail

+4 votes
I am trying to create a auto login where the user inputs id and password and gets logged in in their account. I am able to access the id part but am unable to get the password. It is giving some error.

Can someone help me?
Dec 18, 2018 in Selenium by Anjali
• 2,950 points

1 answer to this question.

+3 votes

Hello @User, this was the error I was facing when I was playing with selenium. Most of the times we get this error because we are trying to use a common element's name such as class name. Id is always distinct for all the web elements. Try using ID all the time and when there is no ID use xpath. 

Here in gmail they have seperate class name for password know as 'password'. Here is the screenshot that I have shared.

You can simply use the name field here like this: 

WebElement password = driver.findElement("password"));
WebElement button1 = driver.findElement(By.className("CwaK9"));;

Here we are first finding element by name i.e. password

then we are clicking on the submit button that button we are finding using ClassName here i.e. "CwaK9"

then we are clicking it. Remember to make the browser wait as you don't want the browser to close before you feed the information.

Hope this helps.

answered Dec 18, 2018 by Nabarupa

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer

What is the actual conflict while performing click() on web element, and getting an error like element is not clickable at point(x,y)?

Hey @sastry, the error Element is not clickable ...READ MORE

answered Nov 27, 2019 in Selenium by Sirajul
• 59,110 points
0 votes
1 answer

Getting error while run the selenium scripts.How can i resolve this issue?

Tq. Yes, it worked for me. READ MORE

answered Jun 16, 2020 in Selenium by anonymous
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
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
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
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
0 votes
1 answer

Getting error while running a XML file in TestNG

Hello @Sradha, The synatx of using test is ...READ MORE

answered Dec 26, 2018 in Selenium by Rashmi
Send OTP
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP