3

I'm getting this exception when calling goto() via Watir:

Net::ReadTimeout with #<TCPSocket:(closed)>
    /usr/lib/ruby/2.6.0/net/protocol.rb:217:in `rbuf_fill'
    /usr/lib/ruby/2.6.0/net/protocol.rb:191:in `readuntil'
    /usr/lib/ruby/2.6.0/net/protocol.rb:201:in `readline'
    /usr/lib/ruby/2.6.0/net/http/response.rb:40:in `read_status_line'
    /usr/lib/ruby/2.6.0/net/http/response.rb:29:in `read_new'
    /usr/lib/ruby/2.6.0/net/http.rb:1509:in `block in transport_request'
    /usr/lib/ruby/2.6.0/net/http.rb:1506:in `catch'
    /usr/lib/ruby/2.6.0/net/http.rb:1506:in `transport_request'
    /usr/lib/ruby/2.6.0/net/http.rb:1479:in `request'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/http/default.rb:129:in `response_for'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/http/default.rb:82:in `request'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/http/common.rb:64:in `call'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/bridge.rb:167:in `execute'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/w3c/bridge.rb:567:in `execute'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/remote/w3c/bridge.rb:59:in `get'
    /var/lib/gems/2.6.0/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/common/navigation.rb:32:in `to'
    /var/lib/gems/2.6.0/gems/watir-6.16.5/lib/watir/navigation.rb:16:in `goto'

It seems that I can modify the timeouts, but I don't understand how.

They are used here, but how do I configure them?

1

1 Answer 1

4

You can refer to Documentation Ruby-Bindings : Internal timeouts

From Documentation : Internal timeouts Internally, WebDriver uses HTTP to communicate with a lot of the drivers (the JsonWireProtocol). By default, Net::HTTP from Ruby's standard library is used, which has a default timeout of 60 seconds. If you call e.g. Driver#get, Driver#click on a page that takes more than 60 seconds to load, you'll see a Timeout::Error raised from Net::HTTP. You can configure this timeout (before launching a browser) by doing:

  client = Selenium::WebDriver::Remote::Http::Default.new
  client.read_timeout = 120 # seconds
  driver = Selenium::WebDriver.for :remote, http_client: client

In Watir it may be something like

caps = Selenium::WebDriver::Remote::Capabilities.chrome          
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 600 
client.open_timeout = 600 
driver =  Watir::Browser.new :chrome, :desired_capabilities => caps, 
:http_client => client
Sign up to request clarification or add additional context in comments.

1 Comment

desired_capabilities => caps is not necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.