问题
I'm having trouble running the automation project on a recently installed Jenkins on a Ubuntu server. I'm having the following error:
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:90:in `connect_until_stable'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:55:in `block in launch'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `new'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `for'
/var/lib/gems/2.3.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in `for'
/var/lib/gems/2.3.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:46:in `initialize'
/var/lib/jenkins/workspace/JobScience/lib/New_Automation/Test/test_basic.rb:15:in `new'
/var/lib/jenkins/workspace/JobScience/lib/New_Automation/Test/test_basic.rb:15:in `setup'
I've read that I should update the selenium-webdriver gem, but I have it up to date. Also installed the firefox plugins in jenkins and still not working.
回答1:
If you just search SO for "Jenkins unable to obtain stable firefox connection in 60 seconds" you will find that this is a fairly common problem. You will also see that it can be caused by a number of things.
- Versioning conflict between FF and Webdriver: (most common) usually because you are not running latest version of firefox, and/or using latest selenium-webdriver gem.
- Permissions issue: account being used by jenkins on the executor system does not have permission to actually execute firefox. If you are testing this by logging into the executor system manually be sure you are using the same user that Jenkins does.
- No display: caused because most jenkins executors run headless. You may need to set an environment variable such as
export DISPLAY=:0
, or run a program like XVFB (a virtual frame buffer), or use the headless gem (which wraps XVFB), so firefox doesn't balk at the lack of a display.
A good initial troubleshooting step is to alter your jenkins script to just have it try to launch firefox itself (not via webdriver), If it runs, then that typically rules out permissions or headless issues, so the issue is between webdriver and firefox. If you get an error, it will likely indicate if the problem is permissions, or lack of a display.
You basically need to eliminate all the possible causes for this issue, which as your search will reveal there are many potential causes and solutions for this. Here's a small sample (yes, each of these is a different SO question, despite the nearly identical titles):
- Unable to start browser from Jenkins CI new!
- Unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
- unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
- unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
- unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) ubuntu
- unable to obtain stable firefox connection in 60 seconds
回答2:
I'm not familiar with the Firefox plugin, you shouldn't need it, and it might be causing the conflicts. Watir uses Selenium which looks for any firefox executable in your path. Make sure Firefox 45 is present on your Ubuntu system in a folder that is listed in $PATH, and Selenium will connect to it.
回答3:
In my experience this is a versioning issue, I've settling on using Firefox 33.0
https://ftp.mozilla.org/pub/firefox/releases/
回答4:
As Chuck van der Linden says
You basically need to eliminate all the possible causes for this issue, which as your search will reveal there are many potential causes and solutions for this.
Then i try to do it Firefox can`t get access to display. Check your Jenkins and(or) Selenium started as service or like program from kde, unity, etc?
来源:https://stackoverflow.com/questions/36917134/unable-to-run-automation-on-firefox-jenkins