2012-07-12 56 views
2

每當我運行測試,先後我收到此錯誤的Watir webdriver的ECONNRESET錯誤

C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET) 
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill' 
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' 
    from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1064:in `head' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:63:in `block in stop' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start' 
    from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:59:in `stop' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/bridge.rb:50:in `quit' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:166:in `quit' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in `close' 
    from test_google.rb:9:in `block in <main>' 
    from test_google.rb:5:in `times' 
    from test_google.rb:5:in `<main>' 

。我相信這是一個網絡驅動程序/硒錯誤,但希望有人能幫我修復或確定原因。

下面是一些代碼,你可以嘗試在IRB運行:

20.times { b = Watir::Browser.new :chrome; b.goto "http://google.com"; p b.div.exists?; b.close;} 

編輯:我更新了我的ChromeDriver並沒有收到錯誤上面的代碼。

回答