Did you try all the solutions on http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups
solution #3 (after some customization) works for me very consistently. On Jan 11, 7:29 pm, Alpinweis <alpinw...@gmail.com> wrote: > I am using the following code taken from Watir Wiki on JS Popups: > > def check_for_popups(title="Windows Internet Explorer", > button="OK", user_input=nil) > popup = Thread.new { > autoit = WIN32OLE.new('AutoItX3.Control') > ret = autoit.WinWait(title,"",60) > if (ret == 1) > puts ">>>Popup<<<" > autoit.WinActivate(title) > puts ">>>after WinActivate<<<" > button.downcase! > if button.eql?('ok') || button.eql?('yes') || button.eql? > ('continue') || button.eql?('open') || button.eql?('allow') > autoit.Send(user_input) if user_input > autoit.Send("{Enter}") > else > autoit.Send("{tab}") > autoit.Send("{tab}") if title == 'Open' > autoit.Send("{Enter}") > end > elsif (ret == 0) > puts ">>>Popup failed to show up<<<" > end > } > at_exit { Thread.kill(popup) } > end > > I am using it with click_no_wait. My problem is that > autoit.WinActivate often fails (looks like at random) when checking > for a 'File Open' popup with a text field for the filename. It never > succeeds on the first run, might succeed on the second or third try. > It does not seem to fail when checking for a simple javasrcipt > confirmation popup. > > I am running on Windows 7 x64, watir 1.6.5, ruby oneclick installer > 1.8.6-27 with the patch for click_no_wait applied, original > AutoItX3.dll registered (downloaded from AutoIt website, since the one > included with watir 1.6.5 does not work for me). There is also an > AutoItX3_x64.dll. I tried to rename it to AutoItX3.dll and register it > but this did not help. > > Would appreciate any help on how to fix this.
-- You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general