2014-06-18 123 views
0

我想使用firefox 17運行我的腳本,但隨後它啓動正確,但無法完全導航。 結果爲Timeout::Error: Timeout::Error。 我不會看到鉻或IE瀏覽器的這個錯誤。 使用JRuby 1.7.12,的Watir-webdriver的0.6.10硒的webdriver 2.42.0獲取錯誤超時::錯誤:超時:: Firefox使用Watir-webdriver的錯誤

require 'watir-webdriver' 
b = Watir::Browser.new 'firefox' 
b.goto 'bit.ly/watir-webdriver-demo' 
b.text_field(:id => 'entry_0').set 'your name' 

錯誤消息

Timeout::Error: Timeout::Error 
from C:/jruby-1.7.12/lib/ruby/1.9/net/protocol.rb:146:in `rbuf_fill' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/protocol.rb:122:in `readuntil' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/protocol.rb:132:in `readline' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:2570:in `read_status_line' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:2559:in `read_new' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:1327:in `transport_request' 
    from org/jruby/RubyKernel.java:1264:in `catch' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:1324:in `transport_request' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:1301:in `request' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:1294:in `request' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:745:in `start' 
    from C:/jruby-1.7.12/lib/ruby/1.9/net/http.rb:1292:in `request' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:612:in `execute' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/remote/bridge.rb:110:in `get' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/selenium-webdriver-2.42.0/lib/selenium/webdriver/common/navigation.rb:14:in `to' 
    from C:/jruby-1.7.12/lib/ruby/gems/shared/gems/watir-webdriver-0.6.10/lib/watir-webdriver/browser.rb:77:in `goto' 
    from (irb):3:in `evaluate' 
    from org/jruby/RubyKernel.java:1101:in `eval' 
    from org/jruby/RubyKernel.java:1501:in `loop' 
    from org/jruby/RubyKernel.java:1264:in `catch' 
    from org/jruby/RubyKernel.java:1264:in `catch' 
    from C:\jruby-1.7.12\/bin/jirb_swing:53:in `(root) 

回答

0
我的情況

這有助於:

TIMEOUT = 300 # set some value in seconds, f.ex. 300 
client = Selenium::WebDriver::Remote::Http::Default.new 
client.timeout = TIMEOUT # seconds – default is 60 
browser = Watir::Browser.new :firefox, :http_client => client 

我有還發現:

require 'net/http' 
http = Net::HTTP.new(@host, @port) 
http.read_timeout = 500 

請檢查它是否有助於您的情況。

+0

不是。它仍然會導致超時。 – mkum

0

更新您的寶石,特別是gem update selenium-webdriver