Just no luck. Still not seeing any popup.

   roles_page.bottom_delete.click_no_wait    # <===== no popup
displayed

but if I use

  roles_page.bottom_delete.click #<=============== popup comes right
up

On Mar 5, 10:17 am, Jim Matthews <jim_m...@swbell.net> wrote:
> One thing I forgot to mention: someone else got click_no_wait to work
> by going into IE ->Tools -> Internet Options...->Advanced and under
> Security, check the box titled "Allow active content to run in files
> on My Computer".
>
> Jim
>
> On Mar 5, 9:32 am, Jim Matthews <jim_m...@swbell.net> wrote:
>
>
>
> > Glad to know that helped.  Now you are at the point I am at.  There
> > are several of us working to see if we can resolve the problem.  It
> > appears that the same Ruby / Watir combination works for some people
> > and does not work for others as far as handling the javascript
> > popups.  Because of this, we think there is some system setting that
> > makes the difference rather than it being strictly a Ruby and Watir
> > problem.  If you have any insights on this, please share them.
>
> > I will try to answer some of your questions.  First the normal "click"
> > that brings up the javascript popup is blocking.  The script cannot
> > proceed until the popup is dismissed.  If the code to dismiss the
> > popup is in the same thread, it stays that way forever (well you know
> > what I mean).  The "click_no_wait" is non blocking, which allows your
> > script to continue with the routine to dismiss the popup.
>
> > So, the short answer is that just "click" won't work for something
> > that brings up a popup (I'll add the qualification that it does work
> > if you create a separate thread to click the popup.  I only mention
> > this because there some examples floating around that do that.  I do
> > not want to lead you too far astray if you find one.)  So the
> > preferred method of clicking something that brings up a popup is
> > "click_no_wait".  Unfortunately, what I am seeing is that the button
> > flashes but no popup ever comes up and the routine to click it times
> > out.  I have had a little success with  "click!".  click!  is also not
> > blocking.  That works one time for me but not the second time in the
> > same script.
>
> > I think the confusion about the page and page container has to do with
> > confusion over the term "page".  The cucumber "page" is not the same
> > exactly the same as the Watir "page".  Beyond that,  I cannot offer
> > much information.  Just be aware that although people use the same
> > "name" for things in different programs, they might not mean the same
> > thing.
>
> > Try the  click!  on the button that brings up the popup and see if
> > that works for you (since it sounds like the click_no_wait doesn't
> > work for you) and let us know your results.  If you figure anything
> > out about system settings that might affect this, let us know.  If I
> > find out anything else for you, I'll post it here.
>
> > Jim
>
> > On Mar 5, 8:12 am, andrew.d...@lthree.com wrote:
>
> > > That got me further.
>
> > > Now I have a question about click_no_wait. When I use just 'click', I
> > > get a popup with an OK and Cancel button. When I use click_no_wait, I
> > > am now not getting any popup. If I use sleep right after
> > > click_no_wait, does the browser keep going so I would expect to see a
> > > popup?
>
> > > And no, the OK button is not getting clicked to clear the popup.
>
> > > Here is the code.
>
> > >     roles_page.roles.row(:name => "Test Role").col1_element.click
> > > #click on checkbox
>
> > > roles_page.bottom_delete.click_no_wait
> > > # shows confirm dialog (only working if I use click)
> > >     sleep 5
> > >     startClicker
> > > ("OK")
> > > # try to click OK button, doesn't work
>
> > > and startclicker is now
>
> > > def startClicker( button_label , waitTime= 9, user_input=nil )
> > >   # get a handle if one exists
> > >   hwnd = nil
> > >   begin
> > >     hwnd = SITE.browser.enabled_popup(waitTime)
> > >   rescue TimeOutException => e #<===============================This
> > > exception is always thrown right now
> > >     #popup not found
> > >   end
>
> > >   if (hwnd)  # yes there is a popup
> > >     puts 'popup found'
> > >     w = WinClicker.new
> > >     w.makeWindowActive(hwnd)
>
> > >     if ( user_input )
> > >       w.setTextValueForFileNameField( hwnd, "#{user_input}" )
> > >     end
>
> > >     # "OK" or whatever the name on the button is
> > >     puts "Trying to click on " + button_label
> > >     w.clickWindowsButton_hwnd( hwnd, button_label )
> > >     #
> > >     # this is just cleanup
> > >     w=nil
> > >   else
> > >     puts "No popup found"
> > >   end
> > > end
>
> > > On a side note, why is enabled_popup defined as part of PageContainer
> > > if it is meant to be called from a browser object only?
>
> > > On Mar 4, 3:21 pm, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > > > OK, too bad you did not include this originally.  I think I know what
> > > > the problem is.  At least I see something that is a problem.  You
> > > > have:
>
> > > > hwnd = page_container.enabled_popup(waitTime)
>
> > > > hwnd belongs to the browser, not the page, so you have to reference
> > > > the borwser object like:
>
> > > > hwnd = $ie.enabled_popup(waitTime)
>
> > > > or change $ie to browser, or whatever you have defined as your browser
> > > > object.
>
> > > > I am doing something similar with Cucumber and I am having trouble
> > > > with this.  It successfully dismisses the first popup I hit but does
> > > > not work on the second.  I hope it works for you.  Let me know,  I am
> > > > still trying to figure out the difference.
>
> > > > Jim
>
> > > > On Mar 4, 3:55 pm, andrew.d...@lthree.com wrote:
>
> > > > > Here is the code
>
> > > > > def startClicker( page_container, button , waitTime= 9,
> > > > > user_input=nil )
> > > > >   # get a handle if one exists
> > > > >   hwnd = page_container.enabled_popup(waitTime)
> > > > >   if (hwnd)  # yes there is a popup
> > > > >     puts 'popup found'
> > > > >     w = WinClicker.new
> > > > >     w.makeWindowActive(hwnd)
>
> > > > >     if ( user_input )
> > > > >       w.setTextValueForFileNameField( hwnd, "#{user_input}" )
> > > > >     end
>
> > > > >     # "OK" or whatever the name on the button is
> > > > >     puts "Trying to click on " + button
> > > > >     w.clickWindowsButton_hwnd( hwnd, button )
> > > > >     #
> > > > >     # this is just cleanup
> > > > >     w=nil
> > > > >   else
> > > > >     puts "No popup found"
> > > > >   end
> > > > > end
>
> > > > > which is triggered by this cucumber step
>
> > > > > Then 'I delete the Test Role role' do
> > > > >     roles_page.roles.row(:name => "Test Role").col1_element.click
> > > > > #clicks on a checkbox (works fine)
> > > > >     roles_page.bottom_delete.click_no_wait        # clicks on the
> > > > > delete button (works fine)
> > > > >     sleep 5
> > > > >     startClicker(roles_page.logon_frame, "OK")   # call function above
> > > > > end
>
> > > > > logon_frame is actually a <div> reference. I am thinking the first
> > > > > parm might be wrong, but what should it be? The browser ref?
> > > > > On Mar 4, 1:44 pm, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > > > > > 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
>
> ...
>
> read more »- 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
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to