Error accessing Birthday variable using Watir during gmail sign-up

197 views Asked by At

I am trying to create the gmail account through watir. As part of it while I am trying to select the birthday using div element I am unable to do.

I tried with the below one:

@ie.div(:text,'May').click

My system configurations:

IE-8
Windows-7
4

There are 4 answers

2
orde On BEST ANSWER

As @titusfortner indicates, that element cannot be selected/clicked because it is not visible. Using watir-webdriver, this snippet makes the dropdown menu visible so its options can be selected:

b.div(title: "Birthday").when_present.click
b.div(text: "May").when_present.click

That being said, there are two other (read: larger) issues:

  1. You won't be able to script your way past the captcha.
  2. Google doesn't want you doing this. That's why the captcha is there, and they'll eventually block your IP if you consistently automate/script against them.
1
titusfortner On

You can't click on the text of something that is not visible on the page. You first need to open the drop-down:

browser.span(id: 'BirthMonth').click
browser.div(text: 'May').click
0
Carldmitch On

I've always disliked seeing the answers on here that say 'Why are you doing this?" or "Why would you want to do this?". So I'll just say "Don't do this!". I'm sure whatever issue you are facing can be resolved without automating the creation of gmail account.

If all you need is a unique gmail address then see the link below: http://www.codestore.net/store.nsf/unid/BLOG-20111201-0411

Another option is https://mailinator.com/

0
Oleksandr Holubenko On
b.element(:css, '#BirthMonth > div').click
b.element(:text, 'May').click

It works with Chrome and with Firefox also but not perfect