[Wtr-general] Javascript Alert windows
David Munns
David.Munns at Configuresoft.com
Wed Oct 4 19:19:47 EDT 2006
Clever code. My problem is slightly different. I am testing a product
that uses a web based GUI, by navigating to all GUI controls and
collecting data for validation comparisons. This product generates the
javascript alert windows to kindly prompt the user that some action has
been completed. They lock up the screen until something clicks the OK
button on the javascript alert window. I want to code the OK button
click for this window, which was opened by the product.
________________________________
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Adam Reed
Sent: Wednesday, October 04, 2006 1:40 PM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] Javascript Alert windows
David,
I remember this being in the FAQ and forum posts, but I haven't been
in a while -- maybe it was removed (I can't check at the moment). First
you define your script that closes the window (I called it jsAlert).
def jsAlert(button, waitTime = 3)
w = WinClicker.new
longName = $ie.dir.gsub("/" , "\\" )
shortName = w.getShortFileName(longName)
c = "start ruby #{shortName}\\watir\\clickJSDialog.rb #{button}
#{waitTime} "
puts "Starting #{c}"
w.winsystem(c)
w=nil
end
Then, before the button you want to click that generates the popup, add
in:
jsAlert("OK", 3)
ie.button(:name, "woohoo").click # This is the button you want to
click that generates the popup
Thanks,
Adam Reed
RelocationCentral by CORT
________________________________
From: wtr-general-bounces at rubyforge.org
[mailto:wtr-general-bounces at rubyforge.org] On Behalf Of David Munns
Sent: Wednesday, October 04, 2006 12:19 PM
To: wtr-general at rubyforge.org
Subject: [Wtr-general] Javascript Alert windows
Does Watir have a way of processing Javascript Alert windows, by
clicking the OK button to dismiss the window? The code that invokes the
window issues an alert call with no window handle. I did not find
anything on this in the online docs or in the email dist.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20061004/d463804a/attachment.html
More information about the Wtr-general
mailing list