I had to alter this method when I had a Pop-up occur from clicking a radio button (couldn't use the click_no_wait). This seemed to get me past that problem. require 'tread' ... def startClicker(button, ieObj) # Strart a new thread that will dismiss the JSPopup. if ieObj != nil then t = Thread.new { w = WinClicker.new hwnd = ieObj.enabled_popup(10) if nil == hwnd w.clickWindowsButton_hwnd(hwnd, button) t.join t = nil w = nil } end
... startClicker('OK', $ie) switch_role.role.select("my role") Hope this helps, --Mark ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of TT Blue Sent: Monday, June 11, 2007 11:00 PM To: wtr-general@rubyforge.org Subject: Re: [Wtr-general] Handling Popup Tried that too, didn't work. It's somewhat interesting because with QuickTest Pro, it identified that dialog as winDialog and I'd thought the winClicker solution would work... but it didn't. On 6/11/07, Hayato Iriumi <[EMAIL PROTECTED]> wrote: I just went through exactly the same issue. Try to use click_no_wait and see what happens. On 6/11/07, TT Blue <[EMAIL PROTECTED]> wrote: > I'm new to Watir as well as Ruby, and I need help handling a pop-up dialog. > > I've searched both the mailing list as well as the trying all that I've > found, but I couldn't get it to click on the "OK" pop-up button. > ============================================================== > require 'watir' > require 'watir\enabled_popup' > #require 'watir/WinClicker' > def startClicker( button , waitTime= 9, user_input=nil ) > # get a handle if one exists > hwnd = $ie.enabled_popup(waitTime) > if (hwnd) # yes there is a popup > w = WinClicker.new > if ( user_input ) > w.setTextValueForFileNameField ( hwnd, "#{user_input}" ) > end > # I put this in to see the text being input it is not necessary to > work > sleep 3 > # "OK" or whatever the name on the button is > w.clickWindowsButton_hwnd( hwnd, "#{button}" ) > # > # this is just cleanup > w=nil > end > end > > switch_role.role.select("my role") > startClicker( "OK", 3, "") > ============================================================== > when I tried code block above, I get this error message: > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require': no such file to load -- watir\contrib\enabled_popup > (LoadError) > from > c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from CMSlogin.rb:2 > > when I try this code block: > > require 'watir/WinClicker' > def sstartClicker( 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 > > switch_role.role.select("my role") > startClicker( "OK", 3) > > This just waits forever and does not click on the OK button. > > ============================================================== > > Can someone please help? > > > > > _______________________________________________ > 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
_______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general