While testing scenario by cucumber
i'm getting the following error when running rspec
tests
unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium::WebDriver::Error::WebDriverError)
Using ruby (1.9.2)
selenium-webdriver (2.27.2)
and firefox (19.0)
Using rspec-rails (2.12.1)
, capybara (2.0.2)
and several other gems, Also i have added launchy
gem but they don't seem to be a problem. And i am using Windows 7
.
Just ran into this on the CI server and found that it was because Firefox had no display to use. I had thought that selenium webdriver would make it work with no further intervention but this was not the case.
Adding Xvfb into the mix made it work.
For Rails running Cucumber features:
then in features/support/env.rb
Downgrade Firefox.
If already using
gem 'headless'
and updating gems is not desirable as for right now, then you need to downgrade firefox.For Ubuntu (but other linux distros would be pretty similar) you should:
Remove firefox that comes with Ubuntu latest versions
You can complement with removing some associated data as explained here
Now, install an older version of Firefox. For me, version 42.0 worked (as our Travis.ci uses it)
Open a new terminal tab and run your cucumber specs/selenium specs.
You can now download the newest version of Firefox and create a
.desktop
file in/usr/share/applications/
to access it from the dock. And let Selenium find by default the older version. Take this for referencefor anyone using Vagrant, if you log in enabling XServer firefox can start correctly which solved it for me. vagrant ssh -- -X
If the above does now work, like in my case, give this a shot.
I was getting the time out error on one machine and not another. Both machines are thin clients running the exact same versions of everything. So that ruled out incompatible firefox versions (error occured on one machine and not the other)
Turned out that there was an issue with the port that headless was using. There was another process using that port.
The below fixed the issue for me:
Add the following line in the .zshenv file
export XVFB_DISPLAY='new-port-number'
then run command
zsh
in terminal to set changeThis error happens when selenium and firefox versions are incompatible.
There are two options.
Update selenium:
gem update selenium-webdriver
If it still fails, then selenium hasn't been updated to the newest version.
Downgrade the version of firefox:
sudo apt-get purge firefox
To see the available packages for download
apt-cache showpkg firefox
sudo apt-get install firefox=#older_version#