[Wtr-development] [JIRA] Closed: (WTR-225) Improve Popup Handling [patch]

Charley Baker (JIRA) watirjira at gmail.com
Sat Oct 2 15:04:30 EDT 2010

     [ http://jira.openqa.org/browse/WTR-225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Charley Baker closed WTR-225.


> Improve Popup Handling [patch]
> ------------------------------
>                 Key: WTR-225
>                 URL: http://jira.openqa.org/browse/WTR-225
>             Project: Watir
>          Issue Type: Bug
>    Affects Versions: 1.5.6
>            Reporter: Bret Pettichord
>            Priority: Major
>             Fix For: 1.6.6
> 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

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.openqa.org/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the Wtr-development mailing list