History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-225
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Bret Pettichord
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Watir

Improve Popup Handling [patch]

Created: 30/Jun/08 12:32 PM   Updated: 30/Jun/08 12:32 PM
Component/s: None
Affects Version/s: 1.5.6
Fix Version/s: 1.6.2

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Here is one way to make this work. This needs to be repackaged to make things easier for users.

Hi all!

I've just spent some time trying to figure out how to dismiss
javascript popups. The information is out there, but it took me a
while to get it all put together and then to try out the various
suggestions until I found one that worked for me. Just in case it
helps someone else, I'll summarize what I found as well as some things
I added here.

1.) You need to update the winClicker.rb file in your watir directory
(in my case, it was at: c:\ruby\lib\ruby\gems\1.8\gems
\watir-1.5.3\watir). Change the dialog title from "Internet Explorer"
to "Windows Internet Explorer". I used the regex /Internet Explorer/
so that it will work no matter which version of IE I use.


2.) Require 'watir/contrib/enabled_popup' for your tests.


3.) Define the popupChecker method to watch for a popup and dismiss
it (in this case, by clicking the button with the specified text):

def popupChecker(text)
    Timeout::timeout(2)do
        begin
            if $ie.enabled_popup
                hwnd = $ie.enabled_popup(5)
                w = WinClicker.new
                w.makeWindowActive(hwnd)
                w.clickWindowsButton_hwnd(hwnd,
text)
            end
        rescue Timeout::Error
            puts 'No popup existed'
        end
    end
end


4.) Use the click_no_wait method on the link or button that will
launch the popup.

ie.button(:text, 'Continue').click_no_wait


5.) Call the popupChecker method in case a popup exists

popupChecker('OK')


I hope this helps!

-Tiffany


 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.