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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Munns
Sent: Wednesday, October 04, 2006 12:19 PM
To: wtr-general@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.

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to