20

I've seen a few posts related to timeout errors within Selenium. This is becoming more and more unbearable as it's rendering my test pack unusable. I'm testing a webpage currently in development.

I have a regression suite of around 300 test scenarios which has always worked until the latest update to firefox and selenium webdriver. Now for almost every other test i'm getting:

Net::ReadTimeout (Net::ReadTimeout) errors.

This can't be coincidence. Would anyone know of what could be causing the sudden timeout problems? I've tried going back to previous versions of webdriver and firefox.

7
  • It started to work again for me with FF32 and the selenium-webdriver-gem v2.43.0. Which versions do you use?
    – tessi
    CommentedOct 14, 2014 at 7:54
  • I'm using FF32.0.3 and webdriver 2.43.0.
    – Tom
    CommentedOct 14, 2014 at 7:56
  • Sorry, I'm out of 'luck' then. My FF 32.0.3 does work (on Ubuntu 14.04).
    – tessi
    CommentedOct 14, 2014 at 8:05
  • I'm finding that it's timing out at the same place everytime during automation, yet running manual tests do not encounter this problem. That's what is pointing me toward Selenium
    – Tom
    CommentedOct 14, 2014 at 8:18
  • I'm having the same issue, did you get to solve it?
    – mrcasals
    CommentedDec 3, 2014 at 10:47

2 Answers 2

13

Another option to use RSpec::Retry which adds a retry option for intermittently failing specs.

require 'rspec/retry' RSpec.configure do |config| # show retry status in spec process config.verbose_retry = true # Try twice (retry once) config.default_retry_count = 2 # Only retry when Selenium raises Net::ReadTimeout config.exceptions_to_retry = [Net::ReadTimeout] end 
2
  • 1
    Just added rspec-retry gem for pesky Net::ReadTimeout errors on Codeship and it did the trick!CommentedDec 4, 2015 at 3:06
  • I use Rspec and I got the gem, copied this code exactly but it doesn't seem to work. It does not even output the retry attempt into the logs, it appears to me as if the code is not executing at all. I used the accepted answer on this thread instead, won't know for a while if it works as the Net::ReadTimeout issue is so occasional. stackoverflow.com/questions/35588363/…
    – Fieldfare
    CommentedOct 7, 2024 at 9:25
10

The default timeout is 60 seconds. One thing to try is to adjust the internal timeout to see if that fixes it:

Capybara.register_driver :selenium do |app| profile = Selenium::WebDriver::Firefox::Profile.new client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 120 # instead of the default 60 Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile, http_client: client) end 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.