2010-02-18 48 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