unable to click text inside the <span> through watir.

1,667 views
Skip to first unread message

Madeshwaran

unread,
May 21, 2008, 1:34:38 AM5/21/08
to Watir General, mades...@gmail.com
Hi,
I am trying to click on a text inside a span in my web page. But
it is not clicking it. when i try to flash it. it flashes.

I also tried to user fire_event("onclick"), still it is not clicking
it.

here is the code :

ie.frame(:index,1).frame(:index,1).div(:id,"nav").span(:index,
3).fire_event("onClick")
ie.frame(:index,1).frame(:index,1).div(:id,"nav").span(:index,3).click

text1 = ie.frame(:index,1).frame(:index,1).div(:id,"nav").span(:index,
3).text

here text1 gives inbox and that text us also flashing when i use
flash.

ie.frame(:index,1).frame(:index,1).div(:id,"nav").span(:index,
3).flash.

Can anyone help me in making the span to click.

I also tried "ie.frame(:index,1).frame(:index,
1).div(:id,"nav").span(:index,3).text.click" it shows error.

Please Help,
Madeshwaran K

Željko Filipin

unread,
May 21, 2008, 8:30:38 AM5/21/08
to watir-...@googlegroups.com
On Wed, May 21, 2008 at 7:34 AM, Madeshwaran <mades...@gmail.com> wrote:
> I am trying to click on a text inside a span in my web page.

You should not click text inside span tag, you should click the whole span tag.

Instead of

ie.span(:index, 3).text.click

try this

ie.span(:index, 3).click

Željko
--
ZeljkoFilipin.com

Madeshwaran

unread,
May 21, 2008, 11:46:42 PM5/21/08
to Watir General
Hi,
I have tried that also but still it is not click the span. Is there
any other solution for that.

Note : I am trying to automate gmail website and the issue thet we are
discussing is about how to click on the "Inbox" / "Sent Mails" /
"Chats".etc.,

On May 21, 5:30 pm, "Željko Filipin" <zeljko.fili...@gmail.com> wrote:

Paul Rogers

unread,
May 22, 2008, 12:28:52 AM5/22/08
to watir-...@googlegroups.com
are you doing this to learn watir or to send emails? If you want to
send emails there is a gmailer library tha will help - google for it.
If you are learning watir, try a simpler site - gmail is very
difficult to understand

Paul

Jason

unread,
May 22, 2008, 5:15:02 PM5/22/08
to Watir General
> Note : I am trying to automate gmail website and the issue thet we are
> discussing is about how to click on the "Inbox" / "Sent Mails" /
> "Chats".etc.,

As Paul said, Gmail is notoriously difficult, if not impossible. If
you really want to just read / send emails, try the gmailer library,
try Net::IMAP, try Net::SMTP, etc, etc. If you still really want to
automate the GMail GUI - just quietly I've discovered the "Basic HTML"
version is easy to understand. Append the following to the end of the
URL:

?ui=html

i.e. http://mail.google.com/mail/?ui=html

... and you're away.

J

Madeshwaran

unread,
Jun 3, 2008, 2:37:55 AM6/3/08
to Watir General
Thanks for the link jason, but my task is to click on the "Compose
Mail" in the regular gmail

Can you help me in that...

thanks
> i.e.http://mail.google.com/mail/?ui=html

Jason

unread,
Jun 3, 2008, 7:54:27 PM6/3/08
to Watir General
> Thanks for the link jason, but my task is to click on the "Compose
> Mail" in the regular gmail

Again, if you try the "Basic HTML" version:

http://mail.google.com/mail/?ui=html

The following works:

irb(main):010:0> ie.link(:text, 'Compose Mail').click
=> 2.891

It's all quite simple.

But within the "standard" view, Google implement some funky things,
looks like nested divs within divs within iframes, and random
div :class / :id values...

I managed to do the following:

ie.frame(:id, 'canvas_frame').div(:class, 'NIPhib').span(:index,
1).click

But I'm pretty sure that :class of 'NIPhib' won't be present next time
I load the page. I'm not sure it's worth it.

J


Reply all
Reply to author
Forward
0 new messages