2013-01-07 41 views
2

的Watir脚本超时问题,我是新来的Watir和我有一个基于AJAX的web应用这种怪异的局面。应用程序可能会在页面上显示通知窗口。这个通知是基于JS的模式窗口。如果我点击或将鼠标悬停在通知它消失。所以在我的剧本我的地方有:与Firefox浏览器

@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 - 红宝石1.9.3p125 - 的Watir-的webdriver(0.6.1) - 硒的webdriver(2.26.0)

谢谢您的帮助!

+2

你可以尝试升级到硒的webdriver的最新版本(2.27.2)?我在Firefox 17中遇到了一些问题,最新的selenium-webdriver版本解决了这个问题。 –

+0

谢谢贾斯汀 - 就是这样!你也可以发布这个提示作为我的问题的答案,我会接受它.. – tom

回答

1

正如在评论中提到的,解决的办法是升级到硒的webdriver的最新版本(2.27.2)。