OK, I looked at example 4.

I noticed that the example incorrectly says require 'Watir' instead of
require 'watir' (the W should be lowercase).

and I assume that you did the :

require 'watir/contrib/enabled_popup'

and I assume you have done some sort of attach of "browser" that
connects it to an IE browser, then does your code fail on the

hwnd = browser.enabled_popup(5)       ?

browser.enabled_popup should return a hwnd only if the browser has a
popup currently displayed.

You can use fxri to help you figure out what is going wrong.  If this
is not correct or does not make sense, include your code.  I also
assume we are still working on the original:

 undefined local variable or method `hwnd' for #<Watir::Frame:
0x3d7b4d4>

problem?

Jim

On Mar 4, 1:23 pm, andrew.d...@lthree.com wrote:
> I was basing my code on example 4. Use click_no_wait on a button I
> know will cause a popup, and then call enabled_popup. The call from
> enabled_popup never returns. I can post the entire exception trace if
> that helps.
>
> On Mar 4, 8:26 am, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > From your first post, I am not sure how you are trying to use
> > ie.enabled_popup.
>
> > I assume you are trying to something like what is described on the
> > wiki:
>
> >http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups
>
> > I do not know which example you are following.  If you take this one
> > for example,
>
> > require 'watir/contrib/enabled_popup'
>
> > 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
>
> > The strange thing to me is that the error you show references a Watir
> > frame.  A frame would not have an hwnd associated with it directly, so
> > I am not sure how you even got the error.
>
> > I am trying to use the routine above and am finding that there must be
> > some things on my system that keep it from working all the time.
> > Sometimes it dismisses the popup and sometimes it doesn't.
>
> > Jim
>
> > On Mar 4, 5:26 am, andrew.d...@lthree.com wrote:
>
> > > Its not my code that is throwing the error. Here is the code for
> > > enabled popup from my watir install. The line generating the error is
> > > hwnd_modal, arr = GetWindow.call(hwnd, GW_ENABLEDPOPUP) - hwnd is
> > > undefined.
>
> > > module Watir
> > >   module PageContainer
> > >     include Win32
> > >     def enabled_popup(timeout=4)
> > >       # Use handle of our parent window to see if we have any
> > > currently
> > >       # enabled popup.
> > >       hwnd_modal = 0
> > >       Waiter.wait_until(timeout) do
> > >         hwnd_modal, arr = GetWindow.call(hwnd, GW_ENABLEDPOPUP)
> > >         hwnd_modal > 0
> > >       end
> > >       # use hwnd() method to find the IE or Container hwnd (overriden
> > > by IE)
> > >       if hwnd_modal == hwnd() || 0 == hwnd_modal
> > >         hwnd_modal = nil
> > >       end
> > >       hwnd_modal
> > >     end
> > >   end
> > > end
>
> > > On Mar 3, 1:49 pm, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > > > I thought you were having the same problem I am with popups, but I
> > > > think yours is different at this point.
>
> > > > The window handle is going to be on the browser and not a part of the
> > > > DOM.
>
> > > > You have to get the hwnd off the browser and go from there.
>
> > > > Jim
>
> > > > On Mar 3, 1:16 pm, andrew.d...@lthree.com wrote:
>
> > > > > Trying to execute enabled_popup and it is throwing an exception
>
> > > > >  undefined local variable or method `hwnd' for #<Watir::Frame:
> > > > > 0x3d7b4d4>
>
> > > > > I checked the source for enabled_popup and it does seem to have an
> > > > > undeclared variable. Is this working for other people. Working on
> > > > > latest version of watir.- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to