Is there have method to stop page loading in watir-webdriver

♀尐吖头ヾ 提交于 2019-12-11 08:22:09

问题


Recently, in a test of my web application test by watir-webdriver, when a link click and a new page open. But the new is keep loading in a long time. And is there have a way to stop it and make browser.ready_state = 'complete' to continue the code follow it.


回答1:


Can you provide more information? If it's a timeout, the timeout class works.

begin
  Timeout::timeout(10) do
end



回答2:


It would be helpful to see your code, but here's a stab at it:

@browser.my_button.when_present.click

The when_present will wait for asynchronous processes to load an element and then you can do an operation as soon as it loads. No waits or sleeps needed.

I made a more detailed post about this here, and you can also refer to the RDoc for more information.



来源:https://stackoverflow.com/questions/10193140/is-there-have-method-to-stop-page-loading-in-watir-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!