History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-75
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Bret Pettichord
Reporter: Bret Pettichord
Votes: 3
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Watir

Add wait_until control structure

Created: 13/Jun/06 01:16 PM   Updated: 10/Jun/08 02:12 PM
Component/s: "Wait"
Affects Version/s: None
Fix Version/s: 1.6.2

Original Estimate: 96h Remaining Estimate: 24h Time Spent: 72h


 Description  « Hide
From: David Schmidt <davids@tower-mt.com>
Reply-To: wtr-general@rubyforge.org
To: wtr-general@rubyforge.org
Date: Jun 13, 2006 12:54 PM
Subject: Re: [Wtr-general] Wait for control to exist
Reply | Reply to all | Forward | Print | Add sender to Contacts list | Delete this message | Report phishing | Show original | Message text garbled?
How about the easy way. Just alias your nice "until_with_timeout" to
"wait_until" so both names work and just use that your first format with
the block. That way the block can contain any code that returns a
boolean, which will allow Andy's request for multiple element support to
work like:

wait_until(timeout) { ie.button(:id, 'btnOne').exists? and ie.span(:id,
'blah').exists? }

with the timeout being optional and using a default_timeout like Bret
suggests below.

This can then support all *sorts* of things that folks wait for,
including thing like the displayed "spinners" that I was waiting to
appear and then disappear.

David

Bret Pettichord wrote:
> How about this:
>
> wait_until(ie.button(:value, "OK").exists?, 10)
>
> The advantage of this form is that we could use any boolean
> expression. So you could wait until a control was disabled or
> whatever. I'm not 100% sure that i can code this, however. I know i
> can implement using a block. Thus:
>
> wait_until(10) {ie.button(:value, "OK").exists?}
>
> This, of course, is the existing until_with_timeout method. Or:
>
> ie.button(:value, "OK).wait_until_exists?(10)
>
> Which follows the normal Watir practice if putting the methods on the
> elements.
>
> Note that in all these examples the timeout would be optional and
> would default to a user-configurable value. Probably
> @@default_timeout. Also, if the timeout were exceeded, it would raise
> a TimeOutException.
>
> Bret

Except that the old until_with_timeout method will be replaced by (rather than aliased to) wait_until

 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.