[wtr-general] Re: waitr - problem with autoit WinActivate - fails at random

2010-01-13 Thread jw
Did you try all the solutions on
http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups

solution #3 (after some customization) works for me very consistently.


On Jan 11, 7:29 pm, Alpinweis alpinw...@gmail.com wrote:
 I am using the following code taken from Watir Wiki on JS Popups:

     def check_for_popups(title=Windows Internet Explorer,
 button=OK, user_input=nil)
       popup = Thread.new {
         autoit = WIN32OLE.new('AutoItX3.Control')
         ret = autoit.WinWait(title,,60)
         if (ret == 1)
           puts Popup
           autoit.WinActivate(title)
           puts after WinActivate
           button.downcase!
           if button.eql?('ok') || button.eql?('yes') || button.eql?
 ('continue') || button.eql?('open') || button.eql?('allow')
             autoit.Send(user_input) if user_input
             autoit.Send({Enter})
           else
             autoit.Send({tab})
             autoit.Send({tab}) if title == 'Open'
             autoit.Send({Enter})
           end
         elsif (ret == 0)
           puts Popup failed to show up
         end
       }
       at_exit { Thread.kill(popup) }
     end

 I am using it with click_no_wait. My problem is that
 autoit.WinActivate often fails (looks like at random) when checking
 for a 'File Open' popup with a text field for the filename. It never
 succeeds on the first run, might succeed on the second or third try.
 It does not seem to fail when checking for a simple  javasrcipt
 confirmation popup.

 I am running on Windows 7 x64, watir 1.6.5, ruby oneclick installer
 1.8.6-27 with the patch for click_no_wait applied, original
 AutoItX3.dll registered (downloaded from AutoIt website, since the one
 included with watir 1.6.5 does not work for me). There is also an
 AutoItX3_x64.dll. I tried to rename it to AutoItX3.dll and register it
 but this did not help.

 Would appreciate any help on how to fix this.
-- 
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

[wtr-general] Re: waitr - problem with autoit WinActivate - fails at random

2010-01-13 Thread Alpinweis
I tried most of the solutions listed there. Had a hell of a time
trying to make one solution work consistently across different windows
platforms, as some solutions work (sometimes though)  on Win 7/IE8
with a patched ruby 1.8.6-27 , but not on XP/IE7 with ruby 1.8.6-26
and vice versa.

I finally gave up on Autoit and settled with a pure win32ole based
solution (solution # 7) that seems to work consistently fine for me on
Win7 x64 with a patched ruby 1.8.6-27 which is my main testing
platform.


On Jan 13, 10:07 am, jw joshuawal...@gmail.com wrote:
 Did you try all the solutions 
 onhttp://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups

 solution #3 (after some customization) works for me very consistently.

 On Jan 11, 7:29 pm, Alpinweis alpinw...@gmail.com wrote:



  I am using the following code taken from Watir Wiki on JS Popups:

      def check_for_popups(title=Windows Internet Explorer,
  button=OK, user_input=nil)
        popup = Thread.new {
          autoit = WIN32OLE.new('AutoItX3.Control')
          ret = autoit.WinWait(title,,60)
          if (ret == 1)
            puts Popup
            autoit.WinActivate(title)
            puts after WinActivate
            button.downcase!
            if button.eql?('ok') || button.eql?('yes') || button.eql?
  ('continue') || button.eql?('open') || button.eql?('allow')
              autoit.Send(user_input) if user_input
              autoit.Send({Enter})
            else
              autoit.Send({tab})
              autoit.Send({tab}) if title == 'Open'
              autoit.Send({Enter})
            end
          elsif (ret == 0)
            puts Popup failed to show up
          end
        }
        at_exit { Thread.kill(popup) }
      end

  I am using it with click_no_wait. My problem is that
  autoit.WinActivate often fails (looks like at random) when checking
  for a 'File Open' popup with a text field for the filename. It never
  succeeds on the first run, might succeed on the second or third try.
  It does not seem to fail when checking for a simple  javasrcipt
  confirmation popup.

  I am running on Windows 7 x64, watir 1.6.5, ruby oneclick installer
  1.8.6-27 with the patch for click_no_wait applied, original
  AutoItX3.dll registered (downloaded from AutoIt website, since the one
  included with watir 1.6.5 does not work for me). There is also an
  AutoItX3_x64.dll. I tried to rename it to AutoItX3.dll and register it
  but this did not help.

  Would appreciate any help on how to fix this.
-- 
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

[wtr-general] Re: waitr - problem with autoit WinActivate - fails at random

2010-01-13 Thread Tony
Hi Alpin

How did you get the click_no_wait to work on the patched ruby
1.8.6-27.
Is the patch on ruby 1.8.6-27, to solve this problem?
If so could you share the patch?

Thanks,
Tony
-- 
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

[wtr-general] Re: waitr - problem with autoit WinActivate - fails at random

2010-01-13 Thread Alpinweis
Tony,

you can find the patch here: http://jira.openqa.org/browse/WTR-320

Need to manually apply the patch as the line numbers in the patch
might not be correct for your version of watir (they are not for watir
1.6.5)

The patch works fine for me with ruby one-click installer 1.8.6-27 on
Win7 x64.

On Jan 13, 7:09 pm, Tony ynot...@gmail.com wrote:
 Hi Alpin

 How did you get the click_no_wait to work on the patched ruby
 1.8.6-27.
 Is the patch on ruby 1.8.6-27, to solve this problem?
 If so could you share the patch?

 Thanks,
 Tony
-- 
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