IE POP UP Window

38 views
Skip to first unread message

FM

unread,
Oct 9, 2008, 9:57:17 AM10/9/08
to Watir General
Hi,

I am trying to test IE pop up window that looks similar to the 'Reload
Page with Form' (http://wiki.openqa.org/display/WTR/Reload+Page+with
+Form) with OK and Cancel button. I need to click on the OK and Cancel
buttons, and have tried the following but it freezes up Watir:
$ie.modal_dialog.button(:text, "Cancel").click

I think I have the latest versions for both Ruby and Watir.

Please help. Thank you.


wesley chen

unread,
Oct 9, 2008, 8:07:50 PM10/9/08
to watir-...@googlegroups.com
There is an easy way to deal with your problem:
require 'watir/dialog'

button***.click_no_wait
dialog.button('OK').click
dialog.button('Cancel').click


Wesley.

Fatema Karim

unread,
Oct 13, 2008, 5:09:23 PM10/13/08
to watir-...@googlegroups.com

Hi Wesley, 

I think it's a javascript pop up and I have tried your suggestions. It seems that if I use click_no_wait then the test stops before getting to the pop up window. Otherwise the screen just hangs. 

Thanks, 

Fatema

wesley chen

unread,
Oct 13, 2008, 10:45:10 PM10/13/08
to watir-...@googlegroups.com
Try the method below:
require 'watir/contrib/enabled_popup'
require 'win32ole'
module PopupClicker
 def ok_cancel_popup(ie,buttonname)
        hwnd = ie.enabled_popup(5)
        if(hwnd)  #yeah! a popup
            popup = WinClicker.new
            popup.makeWindowActive(hwnd) #Activate the window.
            popup.clickWindowsButton_hwnd(hwnd,buttonname) #Click the button
            #popup.clickWindowsButton(/Internet/,buttonname,30)
            popup=nil
        end
    end
end


Wesley Chen.
Reply all
Reply to author
Forward
0 new messages