[wtr-general] Re: Difference b/w Click_no_wait and .Click!

2009-10-14 Thread Shane

The case I have encountered for using click!, is when 'click' doesn't
return for a long time (or sometimes never depending on how buggy a
web page or ad-servers are), and a 'click!' followed by a 'wait_until'
to check the event success/fail is sufficient.

--Shane.

On Oct 13, 12:44 pm, Bret Pettichord  wrote:
> Shane wrote:
> > So if no IE modal dialogs pop up, I would recommend you use click!,
> > because you don't have the overhead of starting up a new ruby process
> > each time.
> > And that has worked for me so far.
>
> In this case, i would recommend using plain old "click". I have not seen
> a use case for "click!"
> Bret
--~--~-~--~~~---~--~~
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: Difference b/w Click_no_wait and .Click!

2009-10-13 Thread Shane

For Watir, the difference is that while click! does it's execution in
the same ruby process, click_no_wait actually creates a new ruby
script to attach to the current IE window and click on the specified
control, and executes that in a completely new process using
rubyw.exe.

The problem this solves (which I've encountered), is that while click!
does not wait for the page to be refreshed, if the button/link pops up
a modal dialog (IE msg window), then that process and contained
threads will still hang while waiting for the modal box to go away.

So if no IE modal dialogs pop up, I would recommend you use click!,
because you don't have the overhead of starting up a new ruby process
each time.
And that has worked for me so far.

I haven't used fireWatir, so can't answer for how that operates.

Thanks,
Shane.


On Oct 11, 9:57 pm, Pallavi Sharma  wrote:
> Hi
> We have installed ruby 1.86-26 only, but whats exactly difference between
> these two methods?
>
> Please let me know.
>
> On Fri, Oct 9, 2009 at 8:56 PM, Charley Baker wrote:
>
> > The one major reason that click! would work and not click_no_wait is if
> > you've installed from the ruby one click installer 1.8.6.27 rc2. Try the
> > previous version 1.8.6.26.
>
> > -c
>
> > On Thu, Oct 8, 2009 at 11:06 PM, Pallavi Sharma 
> > wrote:
>
> >> Hi
>
> >> Can anyone here tell me what are the differences between Click! and
> >> click_no_wait for both watir and firewatir
>
> >> I have a scenario in which click_no_wait is failing but .click! is
> >> working?
>
> >> What could be the reason?
>
> >> Can i use safely .click! instead of click_no_wait even for pop ups??
>
> >> Thanks
>
> >> Pallavi.
--~--~-~--~~~---~--~~
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: Watir cannot connect to IE running under non-Admin account on ‘default’ desktop.

2009-09-28 Thread Shane

Ah, well, it wasn't quite a problem of user rights in the end.

It turns out that the method that Watir uses to enumerate IE windows
(i.e. Shell.Application) does not work across user spaces.  So I had
to write an intermediate application to retrieve the IWebBrowser2 COM
pointer for the IE window, and modify the 'eval_in_spawned_process'
Watir function to use this handle for 'pc = Watir::IE.bind
(iWebBrowserPtr)'.

This now works fine. :)

On Sep 28, 12:34 pm, Bret Pettichord  wrote:
> Shane,
>
> Thanks for the excellent description of the problems that occur when
> your tests run in an account that doesn't have the rights Watir needs.
>
> Bret
>
> On Sep 25, 11:54 am, Shane  wrote:
>
> > Some Background on architecture of the app is needed:
>
> > Windows 2003/Apache-v2.2/IE7/Watir-v1.6.2/Ruby-v1.8.5
>
> >    1. Apache running under 'localsystem' account.
> >    2. Request to run a Watir script comes in.
> >    3. Apache CGI kicks off IE7 under a particular user, e.g. 'tester',
> > and attaches the IE7 window to the "default" desktop environment. This
> > allows us to VNC into the machine and see all IE7 windows from all the
> > accounts running.
> >    4. IE7 has ruby embedded into the process through plugin and
> > executes the ruby script in a thread.
>
> > For clicking on links/buttons in IE, Watir supplies a synchronous
> > 'click' method and async 'click_no_wait' method. 'click_no_wait'
> > spawns a completely new ruby process to connect back to the IE7 window
> > to click the link/button.
>
> > This is what is failing for me. Since click_no_wait is spawning a new
> > process. It cannot seem to see the IE7 window to connect to it and
> > click on the link/button. I have to use 'click_no_wait' due to a
> > dialog box that IE pops up on a certain page, so that another ruby
> > thread can close it.
>
> > I've tried a few things:
> > - using fire_event('OnClick') instead of click_no_wait hangs script
> > like 'click' would.
> > - Modifying 'click' by commenting out '@container.wait', but the
> > 'click!' itself is the API that hangs waiting for the dialog box to
> > close.
> > - Make 'click_no_wait' spawn a new thread instead of a process', but
> > other threads appear to be suspended while the 'click!' call executes
> > in that thread. Which is strange.
> > - Executing the 'click_no_wait' process using the exact same code that
> > is used to spawn the IE7 process, but it still can't find any IE7
> > windows.
>
> > By 'default' desktop described above, the code that spawns IE
> > basically does a series of C++ calls to attach the IE7 window to the
> > 'winsta0' desktop:
>
> > - LogonUser() // log in as tester account
> > - OpenWindowStation("winsta0") // to get default desktop
> > - SetProcessWindowStation()
> > - // add the user to interactive window station using
> > (GetUserObjectSecurity, GetSecurityDescriptorDacl, GetAclInformation,
> > AddAce, SetSecurityDescriptorDacl, SetUserObjectSecurity)
> > - // add user to "default" desktop using APIs listed above.
> > - CreateEnvironmentBlock
> > - ImpersonateLoggedOnUser
> > - CreateProcessAsUser('iexplore.exe')
> > - // cleanup
>
> > Running the following Watir script under the particular user IE7 is
> > running under yields:
>
> > $IE = Watir::IE.attach(:title, /Google/)
> > $IE.button(:name, 'btnG').click!
>
> >     c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:
> > 246:in `method_missing': Windows (WIN32OLERuntimeError) OLE error code:
> > 80040154 in HRESULT error code:0x80020009 Exception occurred. from c:/
> > ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:246:in
> > "each"
>
> > Which contains:
>
> > c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:246
> > shell = WIN32OLE.new("Shell.Application")
> > windows = shell.Windows   ## Fails here
>
> > Let me know if I can supply more details or disambiguation! :)
>
> > Thanks, Shane.
--~--~-~--~~~---~--~~
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] Watir cannot connect to IE running und er non-Admin account on ‘default’ desktop.

2009-09-25 Thread Shane

Some Background on architecture of the app is needed:

Windows 2003/Apache-v2.2/IE7/Watir-v1.6.2/Ruby-v1.8.5

   1. Apache running under 'localsystem' account.
   2. Request to run a Watir script comes in.
   3. Apache CGI kicks off IE7 under a particular user, e.g. 'tester',
and attaches the IE7 window to the "default" desktop environment. This
allows us to VNC into the machine and see all IE7 windows from all the
accounts running.
   4. IE7 has ruby embedded into the process through plugin and
executes the ruby script in a thread.

For clicking on links/buttons in IE, Watir supplies a synchronous
'click' method and async 'click_no_wait' method. 'click_no_wait'
spawns a completely new ruby process to connect back to the IE7 window
to click the link/button.

This is what is failing for me. Since click_no_wait is spawning a new
process. It cannot seem to see the IE7 window to connect to it and
click on the link/button. I have to use 'click_no_wait' due to a
dialog box that IE pops up on a certain page, so that another ruby
thread can close it.

I've tried a few things:
- using fire_event('OnClick') instead of click_no_wait hangs script
like 'click' would.
- Modifying 'click' by commenting out '@container.wait', but the
'click!' itself is the API that hangs waiting for the dialog box to
close.
- Make 'click_no_wait' spawn a new thread instead of a process', but
other threads appear to be suspended while the 'click!' call executes
in that thread. Which is strange.
- Executing the 'click_no_wait' process using the exact same code that
is used to spawn the IE7 process, but it still can't find any IE7
windows.

By 'default' desktop described above, the code that spawns IE
basically does a series of C++ calls to attach the IE7 window to the
'winsta0' desktop:

- LogonUser() // log in as tester account
- OpenWindowStation("winsta0") // to get default desktop
- SetProcessWindowStation()
- // add the user to interactive window station using
(GetUserObjectSecurity, GetSecurityDescriptorDacl, GetAclInformation,
AddAce, SetSecurityDescriptorDacl, SetUserObjectSecurity)
- // add user to "default" desktop using APIs listed above.
- CreateEnvironmentBlock
- ImpersonateLoggedOnUser
- CreateProcessAsUser('iexplore.exe')
- // cleanup

Running the following Watir script under the particular user IE7 is
running under yields:

$IE = Watir::IE.attach(:title, /Google/)
$IE.button(:name, 'btnG').click!

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:
246:in `method_missing': Windows (WIN32OLERuntimeError) OLE error code:
80040154 in HRESULT error code:0x80020009 Exception occurred. from c:/
ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:246:in
"each"

Which contains:

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:246
shell = WIN32OLE.new("Shell.Application")
windows = shell.Windows   ## Fails here

Let me know if I can supply more details or disambiguation! :)

Thanks, Shane.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---