I just released a new version (0.0.4) where you can specify an
optional success-condition block for click:
   window4 = RAutomation::Window.new :title => /Internet Explorer/
   window3.button(:value => "&Run").click {window4.present?}


Try this solution instead of using threads.

Jarmo


On Dec 22, 5:05 pm, Darryl Brown <d-l-br...@roadrunner.com> wrote:
> Hi Jarmo,
>
> Your suggestion on using a thread to handle the second popup is
> essentially what I planned to try. Just haven't had an opportunity to
> get back to it yet. This darn work keeps getting in my way :). I'll
> post an update after I can try this.
>
> Thanks,
> Darryl
>
> On Dec 21, 10:43 am, Jarmo Pertman <jarm...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Does the window itself stay open after clicking &Run? Currently there
> > is a feature, which waits for the button to disappear to accept it as
> > a successful click (there could be many things which might go wrong
> > during the clicking, that's why there is this condition), until that
> > it tries to click again and ends with a timeout.
>
> > I guess there should be a possibility to specify some other condition
> > than default one when button is successfully clicked by a block or
> > something.
>
> > It would be great if you'd create an issue 
> > athttps://github.com/jarmo/rautomation/issues
>
> > I haven't tried the following code, but maybe this (ugly solution)
> > works for you temporarily:
> > Thread.new {window3.button(:value => "&Run").click}
> > window3.child(:title => /popup/). # do something
>
> > Jarmo Pertman
> > -----
> > IT does really matter -http://www.itreallymatters.net
>
> > On Dec 19, 6:33 pm, Darryl Brown <d-l-br...@roadrunner.com> wrote:
>
> > > Hi Jarmo,
>
> > > First I'll say - Great work on this gem!!
>
> > > I have been playing with this and it works very well. I did run into
> > > one thing that I'm not sure on though. If I click in a dialogue that
> > > launches a popup - "window3.button(:value => "&Run").click", the
> > > script hangs and then times out. I don't see a "click_no_wait" method
> > > in the Rautomation::Button class. Is this something that will be
> > > considered.  Perhaps a thread can be used to handle the popup - I'll
> > > try that next.
>
> > > Below is the irb session. After the timeout, I attach to the popup and
> > > finish the intended process .
>
> > > C:\>irb
> > > irb(main):001:0> require "rautomation"
> > > => true
> > > irb(main):002:0> window1 = RAutomation::Window.new :title => /File
> > > Download/
> > > => #<RAutomation::Window:0x28e8ea4 @adapter=:ffi,
> > > @window=#<RAutomation::Adapter
> > > ::Ffi::Window:0x2d7f5a8 @locators={:title=>/File Download/}>>
> > > irb(main):003:0> window1.title
> > > => "File Download - Security Warning"
> > > irb(main):004:0> window1.button(:value => "&Save").click
> > > => true
> > > irb(main):005:0> window2 = RAutomation::Window.new :title => /Save/
> > > => #<RAutomation::Window:0x2d6ab30 @adapter=:ffi,
> > > @window=#<RAutomation::Adapter
> > > ::Ffi::Window:0x2d6aa90 @locators={:title=>/Save/}>>
> > > irb(main):006:0> window2.title
> > > => "Save As"
> > > irb(main):007:0> window2.button(:value => "&Save").click
> > > => true
> > > irb(main):008:0> window3 = RAutomation::Window.new :title => /
> > > Download/
> > > => #<RAutomation::Window:0x2d299c8 @adapter=:ffi,
> > > @window=#<RAutomation::Adapter
> > > ::Ffi::Window:0x2d2984c @locators={:title=>/Download/}>>
> > > irb(main):009:0> window3.title
> > > => "Download complete"
> > > irb(main):010:0> window3.button(:value => "&Run").click
> > > RAutomation::WaitHelper::TimeoutError: timed out after 60 seconds
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/rautomation-0.3.0/lib/
> > > rautomation/wa
> > > it_helper.rb:20:in `wait_until'
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/rautomation-0.3.0/lib/
> > > rautomation/ad
> > > apter/ffi/button.rb:25:in `click'
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/rautomation-0.3.0/lib/
> > > rautomation/bu
> > > tton.rb:15:in `click'
> > >         from (irb):10
> > > irb(main):011:0> window4 = RAutomation::Window.new :title => /Internet
> > > Explorer/
>
> > > => #<RAutomation::Window:0x2d6e0b4 @adapter=:ffi,
> > > @window=#<RAutomation::Adapter
> > > ::Ffi::Window:0x2d6dd1c @locators={:title=>/Internet Explorer/}>>
> > > irb(main):012:0> window4.title
> > > => "Internet Explorer - Security Warning"
> > > irb(main):013:0> window4.button(:value => "&Run").click
> > > => true
> > > irb(main):014:0>
>
> > > Regards
> > > Darryl
>
> > > On Dec 19, 7:25 am, Jarmo Pertman <jarm...@gmail.com> wrote:
>
> > > > That would be great. Please don't forget to give any feedback after
> > > > you've tried it.
>
> > > > Jarmo Pertman
> > > > -----
> > > > IT does really matter -http://www.itreallymatters.net
>
> > > > On Dec 18, 11:27 pm, Arto Vuori <vuo...@iki.fi> wrote:
>
> > > > > Appears promising! I'm about to extend my watir test suite to interact
> > > > > with non-ie windows. I'll give your lib a try.
>
> > > > > --Arto
>
> > > > > On 18 joulu, 01:14, Jarmo <jarm...@gmail.com> wrote:
>
> > > > > > I'm pretty sure that some of you already have noticed the library 
> > > > > > i've made
> > > > > > to automate windows and their controls. I've now written a short 
> > > > > > blog post
> > > > > > about it.
>
> > > > > >http://www.itreallymatters.net/post/2352350743/automating-windows-and...
>
> > > > > > If that thing seems to work well then what do you think if we'd 
> > > > > > replace
> > > > > > AutoIt and win32-api in Watir with this eventually? I'd be happy to 
> > > > > > do that.
>
> > > > > > Jarmo

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to