Forum: Ruby click on link not working with ie #watir-webdriver

Posted by Prog Rammer (proggrammer)
on 2012-11-26 03:35
Greetings,

I can see that there is a <a>-tag in my html. I am able to click it on
firefox by using the code on http://watirwebdriver.com/web-elements/

but I am not able to click the same link when I am on ie. I mean I start
browser on irb using watir-webdriver codes.

I am doing something like:
require 'watir-webdriver'
b = Watir::Browser.start 'bit.ly/watir-webdriver-demo'
l = b.link :text => 'Google Docs'
l.exists?
l.click

I can see everything goes fine till 2nd last statement, it shows that
there is the element.

but when I do l.click on irb, nothing happens and I get an output: []

but this works fine if I start a ff browser.

Any idea? solution?
Posted by Joel Pearson (virtuoso)
on 2012-11-26 10:17
What does this output?

b.links.each {|l| puts l.text}
Posted by Prog Rammer (proggrammer)
on 2012-11-26 11:01
Joel Pearson wrote in post #1086430:
> What does this output?
>
> b.links.each {|l| puts l.text}
that will be ok as I am able to flash also to the right link, I see that 
first focus and then click works. but the problem is I am using 
multithreading, so when it is focused and goes to another window, the 
link loses its focus so again its not working actually.. any solution?
Posted by Joel Pearson (virtuoso)
on 2012-11-26 14:36
Found this on another forum, does it help?

Have you made sure that Internet Options -> Security has the same
Protected Mode setting (on or off, it doesn't matter as long as it is
the same value) for all zones? That's a requirement for the IE driver
functioning correctly.
Posted by Joel Pearson (virtuoso)
on 2012-11-26 14:42
Try this:

require 'watir-webdriver'
b = Watir::Browser.start 'bit.ly/watir-webdriver-demo'
l = b.link :text => 'Google Docs'
b.goto l.href
Posted by Prog Rammer (proggrammer)
on 2012-11-26 14:44
Joel Pearson wrote in post #1086484:
> Found this on another forum, does it help?
>
> Have you made sure that Internet Options -> Security has the same
> Protected Mode setting (on or off, it doesn't matter as long as it is
> the same value) for all zones? That's a requirement for the IE driver
> functioning correctly.

could you pour some more light over what you said? I didnt get by all 
zones.
Posted by Jam Bees (Guest)
on 2012-11-26 14:56
(Received via mailing list)
On 26 Nov 2012, at 06:44, ajay paswan <lists@ruby-forum.com> wrote:

>
It's an IE feature:

https://www.google.co.uk/search?hl=en&client=safar...

https://www.google.co.uk/search?hl=en&client=safar...

The second one there may be super useful.

Jams
Posted by Prog Rammer (proggrammer)
on 2012-11-27 08:27
I uchecked protected mode for all zones. still not working.
Posted by Joel Pearson (virtuoso)
on 2012-11-27 14:43
Joel Pearson wrote in post #1086486:
> Try this:
>
> require 'watir-webdriver'
> b = Watir::Browser.start 'bit.ly/watir-webdriver-demo'
> l = b.link :text => 'Google Docs'
> b.goto l.href

Did you give this a go?
Posted by Prog Rammer (proggrammer)
on 2012-11-28 07:21
Joel Pearson wrote in post #1086687:
> Joel Pearson wrote in post #1086486:
>> Try this:
>>
>> require 'watir-webdriver'
>> b = Watir::Browser.start 'bit.ly/watir-webdriver-demo'
>> l = b.link :text => 'Google Docs'
>> b.goto l.href
>
> Did you give this a go?

I wasn't doing that because I have to deal with submit buttons also, so 
as href property is not there in case of submit button, I am not using 
it.
Posted by Joel Pearson (virtuoso)
on 2012-11-28 09:36
If there's a submit button on a form, you can usually get around it by 
sending "\n" to the last field in the form, or possibly to the button 
itself.
I know that IE has trouble with webdriver, I'm just trying to give you 
alternative ways of looking at the problem, rather than only one option 
(wait for either Microsoft or the awesome volunteers who write IE's 
interface for Watir to find a solution) :)
Posted by Prog Rammer (proggrammer)
on 2012-11-28 15:04
Joel Pearson wrote in post #1086806:
> If there's a submit button on a form, you can usually get around it by
> sending "\n" to the last field in the form, or possibly to the button
> itself.
> I know that IE has trouble with webdriver, I'm just trying to give you
> alternative ways of looking at the problem, rather than only one option
> (wait for either Microsoft or the awesome volunteers who write IE's
> interface for Watir to find a solution) :)
 Got this fantastic article 
http://watirmelon.com/2012/06/18/the-sacred-cow-th... 
. but there are so many solutions, no solid solution, do you think that 
we can get a solid solution compiled from all the solutions mentioned in 
article.

If so lets write a solid solution for all. Because I know how much its 
frustrating when ur goal is a noometer apart from you but you cannot see 
it. :(
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.