You could also just put "include Win32" right above the 
"def enabled_popup(timeout=4)" in /watir/contrib/enabled_popup.rb

--Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Schmidt
Sent: Saturday, October 07, 2006 7:07 PM
To: wtr-general@rubyforge.org; [EMAIL PROTECTED]
Subject: Re: [Wtr-general] Javascript Alert windows

Matt,

The problem is that when the enabled_popup method was removed from 
watir.rb the definitions for GetWindows() definition wasn't moved with 
it.  Afterwards, the definition for GetWindows was moved in the watir.rb

file so that it is no longer found by enabled_popup.

If you look in the watir.rb file for GetWindow and move those 
definitions into the enabled_popup.rb file then it should work fine.

David Schmidt

Matt Johnson wrote:
>
>
> On 10/5/06, *Cain, Mark* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
> wrote:
>
>     The JavaScript Alert, Confirm, Prompt, Security, File Save, File
>     Download, File Upload, error message, and login (I think this is a
>     complete list but there may be others) are all a special type of
>     modal popup dialog window-there isn't a different one.   In order
>     to handle these types of popups you have to start another thread
>     independent of your $ie thread OR you have to not block the
>     process by using click_no_wait.
>
>     There are two ways (that actually both use the WInClicker).  The
>     first one is listed below that works with the older versions of
>     Watir.  The second (I have found after using them both) is more
>     reliable than the first but require you having a Watir version
>     greater than 1079 because of some fixes to click_no_wait (can't
>     remember the exact version).  You can get them here: 
>     http://wiki.openqa.org/display/WTR/Development+Builds
>
>      
>
>     *_First method (works with Watir 1.4.x):_*
>
>     def jsAlert(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
>
>      
>
>     Then, before the button you want to click that generates the
>     popup, add in:
>
>     jsAlert("OK", 3)
>
>     ie.button(:name, "woohoo").click     # This is the button you want
>     to click that generates the popup
>
>      
>
>     *_Second Method (faster and more reliable):_ *
>
>     require 'watir\contrib\enabled_popup'
>
>      
>
>     <Your code>
>
>      
>
>     $ie.button("Button Label Text").click_no_wait
>
>      
>
>     # use click_no_wait to click the button that invokes the JS Alert
>     $ie.button.click_no_wait
>
>      
>
>     hwnd = ie.enabled_popup (5)               # get a handle if one
>     exists
>
>     if (hwnd)                             # yes there is a popup
>
>       w = WinClicker.new
>
>          w.makeWindowActive(hwnd)
>
>     # "OK" or whatever the name on the button is
>
>       w.clickWindowsButton_hwnd(hwnd, "OK")   
>
>     end
>
>      
>
>     NOTE:  If you are using IE7 then the title on the JS Alert box is
>     different then IE6+ so you will need to alter you WinClicker.rb
>     file for either method.
>
>     \ruby\lib\ruby\site_ruby\1.8\watir\WinClicker.rb Lines 113 and
144.
>
>     IE6 = "Microsoft Internet Explorer"
>
>     IE7 = "Windows Internet Explorer"
>
>      
>
>     Hope this helps,
>
>      
>
>     *--Mark*
>
>
>     _______________________________________________
>     Wtr-general mailing list
>     Wtr-general@rubyforge.org <mailto:Wtr-general@rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/wtr-general
>
>
> Hello,
> I have been trying to use the second method described above with no 
> success. I am trying to clear a security dialog that appears after 
> clicking a "Sign In" button. I can see that the button gets clicked, 
> then the script blocks. If I kill the script ( by closing the browser,

> or whatever ) I get this error message:
>
>
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_
popup.rb:10:in 
> `enabled_popup': uninitialized constant 
> Watir::PageContainer::GetWindow (NameError)
> from c:/ruby/lib/ruby/gems/1.8/gems/watir- 
> 1.5.1.1100/./watir/contrib/enabled_popup.rb:9:in `until_with_timeout'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in

> `wait_until'
> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir.rb:210:in

> `until_with_timeout'
> from 
>
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1100/./watir/contrib/enabled_
popup.rb:9:in 
> `enabled_popup'
> from C:/ruby/mattj/scanmus/scanmus3.rb:79
>
> Can anyone tell me what the problem is, or how I can debug this 
> further? Why is this not initialized? Does that mean I have some kind 
> of path or other environment problem. I am using WinXP SP2, ruby 1.8.2

> (2004-12-25) [i386-mswin32], watir 1.5.1.1100.
>
> Thanks in advance.
>
> --
> MattJ
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

_______________________________________________
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

Reply via email to