Gmail password text box not detectable

2,213 views
Skip to first unread message

Nimit Shah

unread,
Jan 1, 2016, 11:20:47 PM1/1/16
to Selenium Users
Hi,
m trying a simple script of logging into gmail
my script identifies the username box but doesnt identify the password box.
i see that when u enter the username and click next the page doesnt refresh or load it just gets the password box.
what selenium command should be used to detect the same?
from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://www.google.com/")
driver.maximize_window()
driver.find_element_by_partial_link_text("Gmail").click()
driver.find_element_by_partial_link_text("Sign in").click()
driver.find_element_by_xpath(".//*[@id='Email']").send_keys("<username>")
driver.find_element_by_id("next").click()
driver.find_element_by_name("Passwd").click()
driver.send_keys("<password>")

for the password textbox i have tried all xpath, id etc but nothing worked.

Krishnan Mahadevan

unread,
Jan 1, 2016, 11:25:39 PM1/1/16
to Selenium Users
Nimit,
Unless and until you are actually working with the GMail testing team, you shouldn't be trying to automate against GMail. It could a violation of their terms and conditions for usage.

If you are doing this because your use case has a step that verifies email, then you should look at leveraging the GMail APIs [ https://developers.google.com/gmail/api/?hl=en ] for doing this.

If you are doing this because you want to get started with learning WebDriver, then you should be using this site instead [ http://the-internet.herokuapp.com/ ] which was created specifically for this purpose.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e449e809-60c4-4f60-897a-d23df419c6d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anup

unread,
Jan 2, 2016, 1:49:36 AM1/2/16
to Selenium Users
I agree with Krishnan, but for the sake of learners understanding below are the changes needed - 


from selenium import webdriver

driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver.maximize_window()
driver.find_element_by_partial_link_text("Gmail").click()
#driver.find_element_by_partial_link_text("Sign in").click() - commented out
driver.find_element_by_xpath("//*[@id='Email']").send_keys("som...@gmail.com")
driver.find_element_by_id("next").click()
#driver.find_element_by_name("Passwd").click() - commented out
driver.find_element_by_name("Passwd").send_keys("aaaa") 

Regards,
Anupam Patil
 

Ansuman Diptimoy

unread,
Jan 2, 2016, 3:52:30 AM1/2/16
to seleniu...@googlegroups.com
Nimit,

 U can use below code.I think it will work ......

WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.com/");
driver.manage().window().maximize();
driver.findElement(By.partialLinkText("Gmail")).click();
driver.findElement(By.id("Email")).sendKeys("<username>");
driver.findElement(By.id("next")).click();
driver.findElement(By.name("Passwd")).sendKeys("Passwd");

Thanks & Regards,
Ansuman Diptimoy


On Sat, Jan 2, 2016 at 9:43 AM, Nimit Shah <nimitde...@gmail.com> wrote:

--

Nimit Shah

unread,
Jan 2, 2016, 9:56:46 PM1/2/16
to Selenium Users
Guys thank you for the reply
Krishnan i choose gmail just like that, but unable to crackdown the password field is something thats boggling me. 

Anshuman & Anup, like i said i have done all that i have got noelementfoundexception when i used id, name and elementnotvisible when i used css selector. just FYI m using Pydev. did these codes work at ur end for firefox? 

Anup

unread,
Jan 2, 2016, 11:07:12 PM1/2/16
to Selenium Users
The suggested code worked\is_working fine on my machine.

Regards,
Anupam Patil
 
Reply all
Reply to author
Forward
0 new messages