有没有办法在 watir-webdriver 中停止页面加载 [英] Is there have method to stop page loading in watir-webdriver

查看:35
本文介绍了有没有办法在 watir-webdriver 中停止页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,在 watir-webdriver 对我的 Web 应用程序进行的测试中,当单击链接并打开一个新页面时.但新的是在很长一段时间内保持加载.有没有办法阻止它并使 browser.ready_state = 'complete' 继续跟随它的代码.

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.

推荐答案

查看您的代码会很有帮助,但请戳这里:

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

@browser.my_button.when_present.click

when_present 将等待异步进程加载元素,然后您可以在加载后立即执行操作.无需等待或睡眠.

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.

我写了一篇关于这个更详细的帖子这里,你也可以参考RDoc 了解更多信息.

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

这篇关于有没有办法在 watir-webdriver 中停止页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆