Yurii Halapup
Yurii Halapup

Reputation: 1362

Net::ReadTimeout: Net::ReadTimeout using selenium-webdriver with Ruby

I use selenium-webdriver gem, Ruby 2.4.4, Rails 4.2 to run Jasmine tests using Firefox.
But unfortunately in most cases I have this error : Net::ReadTimeout: Net::ReadTimeout.

Logs from Selenium show me that test run, but then there is a huge delay after running tests before closing browser.
Could you please advise how to fix that? Or maybe someone had the same issue?
Maybe I can add some code fix this in jasmine_helper.rb ?

Upvotes: 0

Views: 2933

Answers (1)

Rajagopalan
Rajagopalan

Reputation: 6064

The above error was thrown when the page load time exceeds 60 seconds so write the following code for page load

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

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.

Upvotes: 0

Related Questions