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

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to