Watir tests fail when running in background under windows 8 - firefox

I'm running Watir tests in firefox using a jenkins slave installed as service under windows 8 in virtual box.
Testcases include two tests. When I run them manually, everything is fine. When jenkins runs them, the first test always succeeds, and the second always fails with exception:Net::ReadTimeout: Net::ReadTimeout.
I have tried different combinations of test code and begin/rescue blocks, but everytime the exception is caused by browser object methods:
#browser.goto
#browser.execute_script
#browser.wait_until_present
#browser.close
...
Setup and teardown are:
def teardown
#browser.close
end
def setup
profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension #extension_path
#browser = Watir::Browser.new :firefox, :profile => profile
end
gems versions:
watir (4.0.2)
selenium-webdriver (2.33.0)
I have also tried to run service under system account with desktop interaction enabled and under local user account.
One of error logs:
> Net::ReadTimeout: Net::ReadTimeout
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1376:in `request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:852:in `start'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1367:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in `execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:195:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/firefox/bridge.rb:55:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:168:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:135:in `close'
C:/jenkins/workspace/tests_matrix/TEST_BROWSER/firefox/TEST_OS/windows8/build_script_win/tests/test_case2.rb:173:in `teardown'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1316:in `block in run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:21:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:774:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:834:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:838:in `run'
C:/Users/test/AppData/Local/Temp/hudson2953103359547849695.sh:4:in `<main>'

I run into the Net::ReadTimeout error, too, and tried hard to fix it by refresh the browser after catching the Net::ReadTimeout error, like this:
begin
#browser.goto WEBSITE
rescue Net::ReadTimeout
#browser.refresh
sleep 1 unless #browser.ready_state == "complete"
end
I think if you post the test case code, maybe it will help to reach the solution.

Related

Unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) Selenium 3.6.0

I am getting an Issue mentioned in subject, which is an intermittent one. However its making our CI CD pipelines unstable so thought to get some help from geeks available on this great platform.
Since this is an intermittent issue, I don't wish to upgrade my browser version, mentioning it as this comes mostly as the suggestion.
Here are details which may help you to identify the cause which I was not able to
What libraries I use -
gem 'selenium-webdriver', '3.6.0'
gem 'capybara', '2.18.0'
gem 'site_prism', '2.11'
What browser I use -
Firefox - 52.8.0
Which OS I use -
RHEL7
How do I configure my driver -
firefox_profile = Selenium::WebDriver::Firefox::Profile.new
firefox_profile['browser.download.dir'] = '/tmp'
firefox_profile['browser.download.folderList'] = 2
# content-type of file that will be downloaded
firefox_profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/json;application/octet-stream;application/csv;text/csv;application/zip;application/x-zip;application/x-zip-compressed;application/x-rpm;application/pdf;application/xml;application/x-x509-ca-cert'
firefox_profile['timeout'] = 480000
firefox_profile['pdfjs.disabled'] = true
firefox_profile['resynchronization_timeout'] = 90
firefox_profile['resynchronize '] = true
firefox_profile['dom.max_chrome_script_run_time'] = 0
firefox_profile['dom.max_script_run_time'] = 0
Capybara.default_selector = :css
Capybara.ignore_hidden_elements = true
reset_wait_time
Capybara.run_server = false
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 240
if ENV['LOCAL'] == 'true'
STDOUT.puts 'starting local run'
Capybara.default_driver = :firefox
Capybara.register_driver :firefox do |app|
begin
STDOUT.puts 'Attempting to create browser instance'
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: firefox_profile, marionette: false, http_client: client)
rescue => e
STDOUT.puts 'Error: Failed Attempting to create browser instance'
STDOUT.puts e
STDOUT.puts e.backtrace
end
end
begin
page.driver.browser.manage.window.resize_to(1200, 1200)
rescue => e
STDOUT.puts 'Error: Failed resize browser'
STDOUT.puts e
STDOUT.puts e.backtrace
end
end
Error Stack Trace -
starting local run
Attempting to create browser instance
Error: Failed resize browser
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/launcher.rb:89:in `connect_until_stable'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/launcher.rb:53:in `block in launch'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/common/socket_lock.rb:41:in `locked'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/launcher.rb:49:in `launch'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/legacy/driver.rb:47:in `initialize'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/driver.rb:35:in `new'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/firefox/driver.rb:35:in `new'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver/common/driver.rb:54:in `for'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/selenium-webdriver-3.6.0/lib/selenium/webdriver.rb:86:in `for'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/capybara-2.18.0/lib/capybara/selenium/driver.rb:23:in `browser'
/home/rubyuser/web-automation/cucumber/support/env.rb:63:in `block in <top (required)>'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `instance_exec'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:39:in `block in cucumber_instance_exec_in'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:54:in `cucumber_run_with_backtrace_filtering'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/glue/invoke_in_world.rb:27:in `cucumber_instance_exec_in'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/glue/hook.rb:21:in `invoke'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/runtime/before_hooks.rb:23:in `block (2 levels) in before_hooks'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/action.rb:24:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/step.rb:32:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:104:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:51:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:27:in `test_step'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/step.rb:17:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:28:in `block (3 levels) in describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:27:in `each'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:27:in `block (2 levels) in describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/prepare_world.rb:22:in `block in test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/around_hook.rb:17:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:104:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:51:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:34:in `around_hook'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/around_hook.rb:12:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:120:in `block (2 levels) in compose_around_hooks'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:121:in `compose_around_hooks'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:26:in `block in describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/runner.rb:19:in `test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:25:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/prepare_world.rb:11:in `test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:25:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:57:in `test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/retry.rb:18:in `test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:25:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/quit.rb:12:in `test_case'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/case.rb:25:in `describe_to'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:21:in `block in done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:20:in `map'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/filters/broadcast_test_run_started_event.rb:20:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/filters/locations_filter.rb:20:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/filter.rb:62:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/test/filters/tag_filter.rb:18:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/compiler.rb:24:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/parser.rb:39:in `done'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:32:in `parse'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:21:in `compile'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:75:in `run!'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:13:in `execute'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker.rb:96:in `execute_cucumber'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker.rb:41:in `block in start'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker.rb:35:in `fork'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker.rb:35:in `start'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker_queue.rb:116:in `start'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker_queue.rb:53:in `fill'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/worker_queue.rb:35:in `process'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/runner.rb:120:in `process'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/runner.rb:100:in `run'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/gems/cukeforker-2.1.1/lib/cukeforker/runner.rb:40:in `run'
/home/rubyuser/web-automation/cucumber/Rakefile:48:in `concurrent_test'
/home/rubyuser/web-automation/cucumber/Rakefile:16:in `block in <top (required)>'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:160:in `invoke_task'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/home/rubyuser/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/home/rubyuser/.rvm/gems/ruby-2.5.1#global/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/home/rubyuser/.rvm/gems/ruby-2.5.1#global/bin/rake:23:in `load'
/home/rubyuser/.rvm/gems/ruby-2.5.1#global/bin/rake:23:in `<main>'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/bin/ruby_executable_hooks:24:in `eval'
/home/rubyuser/.rvm/gems/ruby-2.5.1#web-automation/bin/ruby_executable_hooks:24:in `<main>'
I know you said you don’t want to be told to update your browser version, but the solution really is going to be putting in the time to update all of your testing gems. The version of every gem you’ve mentioned is obsolete and there have been tons of stability and timing improvements to all the mentioned gems since.
Technically, you’re actually running a version of Firefox that was never really supported by Selenium using the native Firefox driver since Selenium had moved on to focusing on WebDriver (geckodriver) by then. The real solution really is to update.

Selenium Ruby - Can't run the start example (linux)

I want use Selenium with Ruby. I'm on a Ubuntu 15.10
First, I've installed the selenium-webdriver gem.
Now I'm trying to execute the example code:
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
When I do so I get this error:
/home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `read_nonblock': end of file reached (EOFError)
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:39:in `read_status_line'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `catch'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1384:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1377:in `block in request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:853:in `start'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1375:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:107:in `response_for'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:58:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:134:in `get'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/navigation.rb:33:in `to'
When executed, a Firefox window is opened and closed instantaneously (before the driver.quit).

Timeout::Error with Selenium/Capybara/Cucumber/Ruby

We are facing issue when we are executing the scenarios in cucumber ruby using Capybara. After few Scenarios are executed, we are getting time out error and not able to proceed to next scenario.
Following error is displayed
Timeout::Error (Timeout::Error)
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1294:in `request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:746:in `start'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1285:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:612:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:361:in `deleteAllCookies'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/common/options.rb:67:in `delete_all_cookies'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/selenium/driver.rb:84:in `reset!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/session.rb:77:in `reset!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `block in reset_sessions!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `reset_sessions!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/cucumber.rb:10:in `After'
We are using Capybara 2.1.0 version and Cucumber 1.3.8.
Any ideas would be greatly appreciated!

Timeout::Error for selenium while loading heavy page

I'm facing a Timeout::Error issue while loading heavy web page. I observed that even if I added an implicit wait call #driver.manage.timeouts.implicit_wait = 300, a timeout error is thrown before 300 seconds - it's thrown in around 60-70 seconds.
Error thrown is -
Timeout::Error
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1293:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:745:in `start'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1284:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:576:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:99:in `get'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/navigation.rb:14:in `to'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:108:in `get'
backlot.rb:17:in `test_backlot'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit/testcase.rb:17:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:787:in `block in _run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `map'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `_run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:565:in `block in _run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `_run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:746:in `_run_anything'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:909:in `run_tests'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:896:in `block in _run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `_run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:21:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
try using gem fakeweb
FakeWeb is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs.
In GEMFILE write
gem 'fakeweb', :require => false
require 'fakeweb'
use above statement in your file
Hope this would work..
I believe the original issue isn't with Selenium and your question is answered here:
'rescue in rbuf_fill': Timeout::Error (Timeout::Error)

Watir Webdriver ECONNRESET errors

I am getting this error
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET)
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1064:in `head'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:63:in `block in stop'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:59:in `stop'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/bridge.rb:50:in `quit'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:166:in `quit'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in `close'
from test_google.rb:9:in `block in <main>'
from test_google.rb:5:in `times'
from test_google.rb:5:in `<main>'
whenever I run tests successively. I believe it is a webdriver/selenium bug, but would like if someone could help me fix or determine the cause.
Here is some code you can try running in irb:
20.times { b = Watir::Browser.new :chrome; b.goto "http://google.com"; p b.div.exists?; b.close;}
EDIT: I updated my ChromeDriver and do not receive the error for the above code.
In order to fix this try updating your Chrome Driver: http://code.google.com/p/chromedriver/downloads/list

Resources