This has worked pretty well for me.

#Put this method in your script:

  def startClicker( 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 call it right before you click the button (or whatever) that
causes the javascript popup to display:

startClicker("OK" , 3)
$ie.button("Submit").click

You can look at the unittest that come with the Watir package for more
good examples.

Hope this helps,

--Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Shilpa Sainani
Sent: Friday, January 06, 2006 2:16 AM
To: [email protected]
Subject: [Wtr-general] Javascript alert/confirm

Hi,
I am new to watir and its a great tool:). I need help.
I am trying to use it to autoamte my web application
and there are a lot of javascript alerts/confirms in
the application. I have run the autoIT unittests and
they run successfully. HOwever, I do not know how to
make my testscript click OK on a javasscript alert
which is triggered as part of the workflow.
Any ideas?
Thanks!


                
__________________________________________ 
Yahoo! DSL - Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to