Waitr Webdriver 中的警报框
我在这里看了一下: http://wiki.openqa.org/display/ WTR/JavaScript+Pop+Ups
每个解决方案都适用于 Windows 上的 IE。我在 Mac 上使用 Firefox。有没有办法单击 JavaScript 警报框的“确定”?
I had a look here: http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups
Every solution is for IE on Windows. I am using Firefox on Mac. Is there a way to click on OK of a JavaScript alert box?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确处理提醒和提示的问题仍在研究中 WebDriver,但一个常见的解决方法是使用execute_script()覆盖窗口函数,即
因为我想避免一堆猴子补丁四处浮动(Watir社区中的一个常见问题),所以我添加了一些辅助方法作为可选要求 - 在下一个版本之后,您应该能够执行以下
操作 :这是暂时的,当 WebDriver 中的问题得到解决后,该 API 可能会在将来被删除。
更新:
现已实施正确的警报处理。上面的例子现在可以这样完成:
Proper handling of alerts and prompts is still being worked on in WebDriver, but a common workaround is to overwrite the window functions using execute_script(), i.e.
Since I'd like to avoid a bunch of monkey patches floating around (a common problem in the Watir community), I've added some helper methods as an optional require - after the next release you should be able to do:
Note that this is temporary and the API may be removed in the future when the issue is resolved in WebDriver.
UPDATE:
Proper alert handling is now implemented. The above example would now be done like this: