问题
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