Timeout Errors when running tests Cucumber/Watir
Asked Answered
H

2

8

I was hoping someone could help me with a problem I am encountering when running my cucumber tests.

I receive the following error:

  Timeout::Error (Timeout::Error)
      C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
      C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
      C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
      C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
      C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:576:in `execute'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:242:in `getScreenshot'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb:34:in `screenshot_as'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb:18:in `block in save_screenshot'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb:18:in `open'
      C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb:18:in `save_screenshot'

Does anybody have any idea what causes this?

This error occurs randomly during my test suite execution. In the suite I would have something like 150 scenarios and I have seen this error occur at different stages. For example could happen at scenario 50 or scenarios 100. I run my tests via a rake file from Jenkins or via the cmd window but the error occurs if I use either method.

Our test sites here can be a little bit flakey and an odd timeout here and there is probably to be expected. However once this error starts occurring all other tests that follow on from the test the error occurred on will have the same problem. None of my scenarios are dependent on each other. Each scenario generally starts with a step I go to the homepage - in this step in my .rb file I have @browser.cookies.clear included so there should be no data remaining from the previous scenario.

Has anyone else encountered this and if so what steps did you take to sort it?

Hollington answered 17/8, 2012 at 11:49 Comment(8)
Is the same browser instance used for all tests? Which browser are you using (ie is it a browser specific issue)?Dehlia
Hi Justin - I am seeing this problem in Firefox 14 mainly. I have seen other problems using Chrome but not the same issue. I am going to install Opera and see if I get the same issues. Im beginning to think it may be firefox, had a few different problems since I updated. I will let you know how it goes. Thanks!!Hollington
Hey - So I rolled back to Firefox 12 but I still see this issue. I also see this issue occurring on Chrome so I guess it aint the browser. Could it be flash player? I had a huge amount of problems with Firefox and flash version 11.3, so much so that I had to rollback to 11.2. Issue still remains however.Hollington
I also uninstalled selenium webdriver version 2.25 and reinstalled 2.20 but again I see the problem when running the tests. Anybody got any other ideas? Im kinda running out of ideas myself here!!! :-)Hollington
I Am having exactly the same problem, it is a very frustrating. I have tried using other browsers but i cant seem to get chrome to run from jenkins as it never initiates the browser, but thats a differnt problem.Obstruent
I have this problem repeatedly with all newer versions of selenium webdriver and chromedriver. Firefox seems to have no problem. There are several timeout related issues reported with chromedriver code.google.com/p/chromedriver/issues/…Hildahildagard
I have same issues. I have observed that it occurs randomly and I have no idea whyGalileo
Do you close your browser after every scenario? if not try using the hooks.rb to close your browser after every scenario. After do @browser.close endEslinger
H
2

I had the same issue recently. As I can't see your code, I'm not sure what exactly is going on, but using some type of rescue should work. My issue was using a headless browser and rescuing...

  begin
    browser = Watir::Browser.start site
  rescue Timeout::Error
    puts "Timeout Rescue"
  retry

Let me know if this works.

Hayne answered 22/2, 2013 at 5:46 Comment(1)
This is what worked for me. It seems that the page appears to still be loading because of AJAX calls. I just needed to catch the timeout and continue on because the page is actually already loaded.Paymaster
R
1

This is a duplicate question with

Timeout on javascript form only running Cucumber on Jenkins

and the answer on that other questions is solving the problem.

Retsina answered 17/7, 2013 at 15:41 Comment(1)
Looks like the question you have linked to does not have a good answer.Marchelle

© 2022 - 2024 — McMap. All rights reserved.