I just use a watir script to download sequential status infos from a server. In most cases it works fine, but sometimes I get an Net::ReadTimeout error. I don't know why?
Code:
require "rubygems"
require "watir"
Watir.default_timeout = 180 # seconds – default is 60
prefs = { :download => { :prompt_for_download => false, :default_directory => path } }
browser = Watir::Browser.new :chrome, :switches => %w[--no-sandbox], :prefs => prefs
browser.goto 'https://www...'
...
Error Message:
/usr/lib/ruby/2.3.0/net/protocol.rb:158:in `rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
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.0.1/lib/selenium/webdriver/remote/http/default.rb:103:in `response_for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/default.rb:57:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/bridge.rb:653:in `raw_execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/bridge.rb:124:in `create_session'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/bridge.rb:88:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/chrome/bridge.rb:41:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:61:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:61:in `for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver.rb:82:in `for'
from /var/lib/gems/2.3.0/gems/watir-6.0.2/lib/watir/browser.rb:46:in `initialize'
from /var/www/jobs/ubuntu.rb:110:in `new'from /var/www/jobs/ubuntu.rb:5:in `<main>'
I just looking for a reason on this?
Is it possible the customize the settings on firefox? What is wrong?
- Watir Version: 6.0.2
- Selenium Version: 3.0.1
- Browser Chrome Version: 57.0.2987.110
- Chrome Driver Version: 2.29.461571
- OS Version: Ubuntu 16.04.3 LTS
I had a similar problem when running my Selenium Webdriver tests on our Ubuntu Jenkins build server, but I never experienced this locally on my Windows PC. Like your problem, it was an intermittent issue. I spent quite a lot of time researching it and couldn't get to the bottom of it, I did however put it down to a Ruby/ Ubuntu issue rather than an issue with the test, because of this, I decided to rescue the Net::ReadTimeout error and retry. Since implementing the following example, I haven't experienced this problem again.
You should be able to briefly modify the above example to work with Watir. It basically captures the error and retries/ re-runs the test.