开发者

selenium RC ruby, wait for hidden element to appear?

How can I wait for 开发者_如何学运维a hidden element to appear on the page?

I tried seleum.is_element_present but it dosent seem to be working.


What you want is the is_visible method. Below will wait for 30 seconds to become visible

!30.times{ break if (@selenium.is_visible("locator") rescue false); sleep 1 }


wait_for_element(locator, options={})

Wait for an element to be present (the wait in happenning browser side).


Came across the same problem using Watir, present? only works if element is visible. To wait for an invisible element to appear you can do this in Watir

Watir::Wait.until { browser.div(:class => "loaded").exists? }

exists? returns true if element is in the DOM, doesn't care about visibility

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜