How to use watir-webdriver to wait for page load

后端 未结 7 1855
后悔当初
后悔当初 2021-02-01 21:34

Using watir-webdriver, how do I wait for a page to load after I click a link?

At the moment I am using:

sleep n

But this is not ideal a

7条回答
  •  日久生厌
    2021-02-01 22:23

    I don't know if they're the best way, but this is how I'm handling this for waiting for an updating div to clear:

    while browser.div(:id=>"updating_div").visible? do sleep 1 end
    

    This is how I handle waiting for something to display:

    until browser.div(:id=>"some_div").exists? do sleep 1 end
    

提交回复
热议问题