[Wtr-general] Javascript Alert windows
Adam Reed
areed at relocationcentral.com
Wed Oct 4 15:39:33 EDT 2006
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/3654d9fb/attachment-0001.html
More information about the Wtr-general
mailing list