There was a recent thread on this so you may want to search the email archive.
This is what we do, but I don't know if it is the best way. require 'watir\ie' require 'watir\contrib\enabled_popup' # Main method to click a modal dialog button. def click_modal_button(ie, type='OK', sleep_time=6, timeout=20) hwnd = ie.enabled_popup(sleep_time) if (hwnd) w = WinClicker.new w.clickWindowsButton_hwnd( hwnd, "#{type}") w=nil end end On Thu, May 14, 2009 at 3:35 PM, satish <spanchumar...@gmail.com> wrote: > > Can you some one give me an idea how to work with popups. > > Here is my requirement. > ----------------------------------------- > When I click on "Save" image icon on the IE browser, according to data > validation rules I will get a warning popup box. > > I will have to validate the warning message on the popup box whether > it is correct or not and then needs to respond by click on "OK" > button. > > Can some one give me an idea around this. I am very new to Watir. > Appreciate your help. > ======================================================== > > Here I tried this....but did not work.. > ============================== > require "watir" > require "win32ole" > require "watir/contrib/enabled_popup" > > ie.image(:id, > > 'ctl00_contentChildWindow_secUserDetails_ctl02_menu_secUserDetails_DXI0_Img').click > hwnd = ie.enabled_popup(5) > if (hwnd) #yeah! a popup > popup = WinClicker.new > popup.makeWindowActive(hwnd) > popup.clickWindowsButton("Windows Internet Explorer", "OK", "30") > end > ======================================================= > >ruby Phone_Mask_Test.rb > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/contrib/ > enabled_popup.rb:5: uninitialized constant Watir::PageContainer::Win32 > (NameError) > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require' > from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `require' > from Phone_Mask_Test.rb:4 > >Exit code: 1 > > Thank you, > Satish > > > > -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) http://lisacrispin.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---