Net::ReadTimeout Error when Watir::Browser.new - ruby

I'm trying to start watir browser,
irb(main):001:0> require 'watir'
=> true
irb(main):002:0> browser = Watir::Browser.new
Watir opens a new chrome browser with data:,wrote in the search bar. After 60 seconds of waiting, the browser just closes, and I'm getting this error in console:
Net::ReadTimeout: Net::ReadTimeout
from /usr/lib/ruby/2.3.0/net/protocol.rb:158:in `rbuf_fill'
from /usr/lib/ruby/2.3.0/net/protocol.rb:136:in `readuntil'
from /usr/lib/ruby/2.3.0/net/protocol.rb:146:in `readline'
from /usr/lib/ruby/2.3.0/net/http/response.rb:40:in `read_status_line'
from /usr/lib/ruby/2.3.0/net/http/response.rb:29:in `read_new'
from /usr/lib/ruby/2.3.0/net/http.rb:1437:in `block in transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `catch'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1407:in `request'
from /usr/lib/ruby/2.3.0/net/http.rb:1400:in `block in request'
from /usr/lib/ruby/2.3.0/net/http.rb:853:in `start'
from /usr/lib/ruby/2.3.0/net/http.rb:1398:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:121:in `response_for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:76:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/common.rb:62:in `call'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:97:in `create_session'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:53:in `handshake'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/chrome/driver.rb:48:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/driver.rb:44:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/driver.rb:44:in `for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver.rb:86:in `for'
from /var/lib/gems/2.3.0/gems/watir-6.13.0/lib/watir/browser.rb:48:in `initialize'
from (irb):3:in `new'
from (irb):3
from /usr/bin/irb:11:in `<main>'
How could I solve this issue?

watir 6.19.0+
As of watir version 6.19.0, they provide their own HTTPClient so you can just do something like this:
Watir::Browser.new :firefox, http_client: { read_timeout: 120 }

As you said this happens when page load exceeds 60 seconds, you can increase the page load timeout by the following code
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 120 # seconds
driver = Selenium::WebDriver.for :firefox,http_client: client
b=Watir::Browser.new driver
Now your code would wait for 120 seconds for any page load which has been caused by #click and also wait to load the url by goto method.

Related

Selenium Ruby - Can't run the start example (linux)

I want use Selenium with Ruby. I'm on a Ubuntu 15.10
First, I've installed the selenium-webdriver gem.
Now I'm trying to execute the example code:
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
When I do so I get this error:
/home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `read_nonblock': end of file reached (EOFError)
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:39:in `read_status_line'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `catch'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1384:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1377:in `block in request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:853:in `start'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1375:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:107:in `response_for'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:58:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:134:in `get'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/navigation.rb:33:in `to'
When executed, a Firefox window is opened and closed instantaneously (before the driver.quit).

Watir tests fail when running in background under windows 8

I'm running Watir tests in firefox using a jenkins slave installed as service under windows 8 in virtual box.
Testcases include two tests. When I run them manually, everything is fine. When jenkins runs them, the first test always succeeds, and the second always fails with exception:Net::ReadTimeout: Net::ReadTimeout.
I have tried different combinations of test code and begin/rescue blocks, but everytime the exception is caused by browser object methods:
#browser.goto
#browser.execute_script
#browser.wait_until_present
#browser.close
...
Setup and teardown are:
def teardown
#browser.close
end
def setup
profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension #extension_path
#browser = Watir::Browser.new :firefox, :profile => profile
end
gems versions:
watir (4.0.2)
selenium-webdriver (2.33.0)
I have also tried to run service under system account with desktop interaction enabled and under local user account.
One of error logs:
> Net::ReadTimeout: Net::ReadTimeout
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1376:in `request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:852:in `start'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1367:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in `execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:195:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/firefox/bridge.rb:55:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:168:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:135:in `close'
C:/jenkins/workspace/tests_matrix/TEST_BROWSER/firefox/TEST_OS/windows8/build_script_win/tests/test_case2.rb:173:in `teardown'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1316:in `block in run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:21:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:774:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:834:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:838:in `run'
C:/Users/test/AppData/Local/Temp/hudson2953103359547849695.sh:4:in `<main>'
I run into the Net::ReadTimeout error, too, and tried hard to fix it by refresh the browser after catching the Net::ReadTimeout error, like this:
begin
#browser.goto WEBSITE
rescue Net::ReadTimeout
#browser.refresh
sleep 1 unless #browser.ready_state == "complete"
end
I think if you post the test case code, maybe it will help to reach the solution.

Is there anyway to stop the pageload from the browser?

require 'rubygems'
require 'selenium-webdriver'
require 'win32ole'
driver = Selenium::WebDriver.for :firefox
driver.manage.timeouts.implicit_wait = 10
driver.get "https://prod.example.com/"
link_name = wait.until {
element = driver.find_element(:link_text, "Company")
element if element.displayed?
}
link_name.click if link_name
But as the page load is not completed my script got failed everytime producing the below error:
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill': Timeout:
:Error (Timeout::Error)
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140: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_r
equest'
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:1286:in `block in request'
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:1284:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/default.rb:83:in `response_for'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/default.rb:39:in `request'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/http/common.rb:40:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:615:in `raw_execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:593:in `execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/remote/bridge.rb:561:in `find_element_by'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2/lib/s
elenium/webdriver/common/search_context.rb:42:in `find_element'
from C:/Documents and Settings/rakshiar/My Documents/userdata/Ruby/Scrip
ts/answerlist.rb:29:in `rescue in <main>'
from C:/Documents and Settings/rakshiar/My Documents/userdata/Ruby/Scrip
ts/answerlist.rb:21:in `<main>'
Thus I am looking for to stop the page load after say 20 seconds, and then hit the element as I put in the above code. Becuase I checked when the page is started loading if I try to see the page source,I am not getting any web element. But after the start of page loading if I closed it from start to 10-12 seconds, and try to see the webpage sourece code, all the the required elements there.
So I want to do the same progamatically. Any idea how to do that?
In Selenium2 API, On default there is no option to stop the page loading. It will wait for up to the page finishes the loading.
Try this code:
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
The above code will wait up to 10 seconds for page loading. If the page loading exits the time it will throw the TimeoutException. You catch the exception and do your needs. I am not sure weather it quits the page loading after the exception thrown. i didn't try this code yet. Want jsut try it.
For more info.

Timeout::Error for selenium while loading heavy page

I'm facing a Timeout::Error issue while loading heavy web page. I observed that even if I added an implicit wait call #driver.manage.timeouts.implicit_wait = 300, a timeout error is thrown before 300 seconds - it's thrown in around 60-70 seconds.
Error thrown is -
Timeout::Error
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1293:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:745:in `start'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1284:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:576:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:99:in `get'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/navigation.rb:14:in `to'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:108:in `get'
backlot.rb:17:in `test_backlot'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit/testcase.rb:17:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:787:in `block in _run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `map'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `_run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:565:in `block in _run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `_run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:746:in `_run_anything'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:909:in `run_tests'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:896:in `block in _run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `_run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:21:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
try using gem fakeweb
FakeWeb is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs.
In GEMFILE write
gem 'fakeweb', :require => false
require 'fakeweb'
use above statement in your file
Hope this would work..
I believe the original issue isn't with Selenium and your question is answered here:
'rescue in rbuf_fill': Timeout::Error (Timeout::Error)

Watir Webdriver ECONNRESET errors

I am getting this error
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>'
whenever I run tests successively. I believe it is a webdriver/selenium bug, but would like if someone could help me fix or determine the cause.
Here is some code you can try running in irb:
20.times { b = Watir::Browser.new :chrome; b.goto "http://google.com"; p b.div.exists?; b.close;}
EDIT: I updated my ChromeDriver and do not receive the error for the above code.
In order to fix this try updating your Chrome Driver: http://code.google.com/p/chromedriver/downloads/list

Resources