gpt4 book ai didi

ruby - Firefox 浏览器的 Watir 脚本超时问题

转载 作者:太空宇宙 更新时间:2023-11-03 16:32:06 25 4
gpt4 key购买 nike

我是 Watir 的新手,我在使用基于 AJAX 的 Web 应用程序时遇到了这种奇怪的情况。应用程序可能会在页面上呈现一个通知窗口。此通知是一个基于 JS 的模态窗口。如果我单击或将鼠标悬停在通知上,它就会消失。所以在我的脚本中的某处我有:

@browser = Watir::Browser.new :firefox
...
notf = notification
notf.click if notf

获取通知的方法是这样的:

def notification
if browser.div(:class => "popupContent").present?
Notification.new(browser.div(:class => "popupContent"))
end
end

脚本在 IE 和 Chrome 上运行良好,但在 Firefox 上我在 60 秒后得到 if 语句的“超时:错误”。当我这样更改代码时:

def notification
begin
browser.div(:class => "popupContent").wait_until_present(1)
Notification.new(browser.div(:class => "popupContent"))
rescue Exception
puts "timeout..."
end
end

Chrome 和 IE 工作正常 - 只是在通知不存在的情况下增加 1 秒的延迟。但是 Firefox 仍然有 60 秒的超时以防通知不存在?!?我做错了什么——我需要设置/检查一些 Firefox 设置吗?我有这个配置:- Win7 操作系统与 Firefox 17.0.1- ruby 1.9.3p125- watir-webdriver (0.6.1)- Selenium 网络驱动程序 (2.26.0)

感谢您的帮助!

最佳答案

如评论中所述,解决方案是升级到最新版本的 selenium-webdriver (2.27.2)。

关于ruby - Firefox 浏览器的 Watir 脚本超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14188847/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com