I called the function I wrote "wait_for", though I like your
until_with_timeout method that uses yield better.
Then we could do something like:
wait_for(10) { ie.button(:value, 'OK') }
or just do it as a function like
wait_for( ie.button(:value, 'OK'), 10 )
We could just use your until_with_timeout as is, too:
until_with_timeout(10) { ie.button(:value, 'OK').exists? }
I've been using that already to wait for AJAX events to complete by
watching for a "spinner" to appear and then disappear:
# wait for "Updating" spinner to appear
Watir::until_with_timeout(5) do
@ie.div(:id, 'pnlLoading').document.style.invoke('display')
!= 'none' &&
@ie.div(:id,
'pnlLoading').document.style.invoke('visibility') != 'hidden'
end
# wait for "Updating" spinner to hide
Watir::until_with_timeout(30) do
@ie.div(:id, 'pnlLoading').document.style.invoke('display')
== 'none' ||
@ie.div(:id,
'pnlLoading').document.style.invoke('visibility') == 'hidden'
end
We may wish to make it a bit more "visible" though, so it can be used
without the "Watir::" at the front.
David
Bret Pettichord wrote:
> So, i think everyone can at least agree that it would be nice to have
> a method on Watir elements that would not return until the element
> appeared on a page. E.g.:
>
> ie.button(:value, "OK").dont_return_until_this_element_exists
>
> This would be analogous to the existing ie.wait method, except that
> that waits for the page to load the browser to no longer be busy.
>
> The only thing is -- what should it be called?
>
> Some ideas...
>
> ie.button(:value, "OK").wait_until_exists?
> ie.button(:value, "OK").wait_til_exist?
> ie.button(:value, "OK").wait
> ie.button(:value, "OK").ever_exist?
>
> Bret
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general