From: Jesús Gabriel y Galán on 13 Aug 2010 08:08
2010/8/13 Jesús Gabriel y Galán <jgabrielygalan(a)gmail.com>:
> On Fri, Aug 13, 2010 at 1:53 PM, Mario Ruiz <tcblues(a)gmail.com> wrote:
>> But the thing is... if you click first.. ff keeps waiting and doesn't
>> return the control to ruby so in theory the only way to do it is call
>> startClicker first and then click the button... but it's not working
>> properly since what it is doing is just closing the JS window but not
>> clicking on the button as you can see in this example:
>> require "firewatir"
>> $ff = FireWatir::Firefox.new() #create an object to drive the browser
>> $ff.startClicker( "OK", 4)
>> $ff.button(:value,"Show a confirm box").click
>> sleep 3
> I don't know if you have other example that does something in the page
> when OK is clicked.
> What startClicker does, is to override the window.alert function with
> a function that returns OK, so really no popup is open at all.
It also does the same with the confirm button, so your example should
work. I've tested it and it works (debugging with Firebug I see that
the call r = confirm.. returns true).
From: Jesús Gabriel y Galán on 13 Aug 2010 08:10
On Fri, Aug 13, 2010 at 2:07 PM, Mario Ruiz <tcblues(a)gmail.com> wrote:
code will work as if the user had pressed the OK or the cancel button,
so everything should continue executing normally.
From: Mario Ruiz on 13 Aug 2010 08:14
Because, in some cases the page is doing different things depending what
I'm selecting... for example, the window says: do you want to go to
www.google.com? and the options: Yes, No
Posted via http://www.ruby-forum.com/.
From: Jesús Gabriel y Galán on 13 Aug 2010 09:04
On Fri, Aug 13, 2010 at 2:14 PM, Mario Ruiz <tcblues(a)gmail.com> wrote:
> Because, in some cases the page is doing different things depending what
> I'm selecting... for example, the window says: do you want to go to
> www.google.com? and the options: Yes, No
But then you can automate to one option or the other with
startClicker("OK") or startClicker("cancel") (or maybe "Cancel", I'm