2010-02-18 38 views
1

我在网站上使用Selenium Ruby客户端的性能很差。由于暂停,我的脚本每次都会失败。现在,我正在研究如何在使用Selenium时设置超时限制。硒超时?如何设置超时限制?

我(Ruby)的脚本是

selenium.set_timeout(30000000000000) # does not work? 
selenium.open myurl 

在硒日志,我可以看到的setTimeout方法被称为

setTimeout(30000000000000) 
open(https://.... 

所以它看起来像一些时间方法被调用,但它不”不要为开放做任何事情。超时保持默认值。有没有其他时间我应该打开使用的方法?

感谢 ONNO

回答

5

你有创建硒选项时尝试timeout_in_seconds选项?该选项由打开命令使用。

def setup 
    @verification_errors = [] 
    @selenium = Selenium::Client::Driver.new \ 
    :host => "localhost", 
    :port => 4444, 
    :browser => "*chrome", 
    :url => "http://localhost:3000/", 
    :timeout_in_seconds => 60 

    @selenium.start_new_browser_session 
end 
0

我有同样的问题,上面的解决方案没有为我工作。然后,我改变

:timeout_in_second => 30 

:timeout_in_seconds => 30 

和现在一切正常:

INFO - Command request: setTimeout[30000, ] on session c1e82f8ce2bf45e184f1aa93b4ba3f21