Cut and paste this method in your script exactly as is:

 

# method to click JS popups

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

 

# just before your button that invokes the JS popup put this:

  startClicker("OK" , 3)

  $ie.button(‘Submit’).click

 

 

NOTE:  I use c = “start ruby…” rather than c = “start rubyw…” because using rubyw rarely, if ever, works for me.

 

Hope this helps,

 

--Mark

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Adam Reed
Sent: Friday, June 16, 2006 11:53 AM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] JS pop-up trouble, new methods in 1.5.1?

 

I have one test that generates a _javascript_ "OK" pop-up window that I am

unable to close.

 

I have attempted both methods from

http://wiki.openqa.org/display/WTR/FAQ to close this window.

 

When using the startClicker method, when the JS pop-up triggers, you can

see it lose focus as if startClicker has clicked, just not in the

correct place.  I found a posting from another Watir user back in

February having the same problem and unfortunately he did not receive

feedback from other users or a resolution.  The code in both of our test

cases is verbatim from the FAQ.

 

During my searches for a solution, I also noticed a lot of talk about

the 1.5.1 release including some new accepted method for addressing JS

functions, but I haven't been able to find out specifically what that

is.  Is there a new approach I should know about?

 

Thanks in advance,

 

Adam Reed

 

_______________________________________________

Wtr-general mailing list

Wtr-general@rubyforge.org

http://rubyforge.org/mailman/listinfo/wtr-general

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

Reply via email to