ChatGPT解决这个技术问题 Extra ChatGPT

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

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.

Show a reproduction case (if it's large, post it to gist.github.com).
We just had this start happening over the weekend to previously stable tests and did a bundle update to fix it.
May changing browser default to chrome's supportable version for selenium-webdriver will fix this problem or not?
I have posted reproduction case here. gist.github.com/4536512
FWIW: your gist is a stack trace, not a reproduction case.

b
ballPointPenguin

I had the same problem (on Linux). Fixed with:

gem update selenium-webdriver

Now I am using ruby 1.9.3-p286, selenium-webdriver 2.29.0, firefox 18.0 As well as rspec-rails 2.9.0, capybara 1.1.2, and capybara-webkit 0.12.1

I added selenium-webdriver 2.29.0 to my Gemfile to be safe.


Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Updating selenium-webdriver worked for me on Mac OS X 10.6.8/ruby 1.9.3-p194
Totally works! Thanks so much. I'm using selenium-webdriver 2.34.0 and firefox 19 (I downgraded 23 to 19, I didn't try on FF 23) without any error.
Yep, Firefox 22 in OS X just sits there before finally the test times out with that error.
Here's the US English version of Firefox 19 for OS X: ftp.mozilla.org/pub/mozilla.org/firefox/releases/19.0/mac/en-US
This should not be the approved answer. stackoverflow.com/a/18263152/712188 is the more correct answer.
M
Micah Alcorn

It seems Selenium Webdriver gets frequent updates to keep up with Firefox. But how do you know which version you need? Hopefully this procedure will work even as versions change:

Go to http://www.seleniumhq.org/download/. Scroll down to Selenium Client & WebDriver Language Bindings. In that section, in the Ruby language line, click on "Change Log" (direct link). In the Change Log, determine which version of Selenium you need for your version of Firefox.

If you're using Bundler, run bundle show selenium-webdriver to see which version you have. To update, for example to 2.35.0, add this line to your Gemfile:

gem 'selenium-webdriver', '2.35.0'

and then run bundle update to install. If you are using Spork, remember to re-start it before re-running your tests.

Update One StackOverflow answer indicates that the Change Log may be updated sooner in the source code repository than at seleniumhq.org. The repository Change Log for Ruby is here: https://github.com/SeleniumHQ/selenium/blob/master/rb/CHANGES.

Downgrading Firefox

If you need to downgrade Firefox on Ubuntu 12.04, this answer explains how to go back to Firefox 20. A more general description of a way to switch to any version of Firefox is given here. Then use this answer to put Firefox updates on hold until Selenium releases an update that works with the later version of Firefox.

In my case, I downgraded Firefox only to discover that Selenium Webdriver had recently been updated to handle the latest version, so check for Selenium updates first!


r
rusllonrails
bundle update selenium-webdriver

M
Matt Gibson

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:

gem 'headless'

then in features/support/env.rb

Before do
  if Capybara.current_driver == :selenium
    require 'headless'

    headless = Headless.new
    headless.start
  end
end

What is javascript equivalent to your features/support/env.rb ?
Don't know specifically, but it's a file that is included and run before all the tests start.
p
pgerstoft

This 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#


S
Shiprack

The magic combination that worked for me was Firefox 19.0 and selenium web-driver 2.32.1 (latest at the time of writing). Firefox 20.x and 21.x did not work. I had to downgrade Firefox. Also keep in mind that (at least on Mac OS), if you go to FireFox Menu -> About Firefox, it will automatically upgrade to the latest release. Don't do that.


o
orion

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 change


t
ttguy

I had this issue when I was starting irb from a terminal where I had su ed my self to another user. I would get this error when I ran irb as that user. But not if I ran as root. And not when I exited back out to a shell owned by the logged in user.


A
Alexander Williamson

For me, I had already updated the gems but then needed to update my bundle.

In powershell, navigate to your directory then update the bundle:

cd D:\Projects\LazyAutomation
bundle update

B
Ben

for anyone using Vagrant, if you log in enabling XServer firefox can start correctly which solved it for me. vagrant ssh -- -X


j
juliangonzalez

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

sudo apt-get purge firefox

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)

$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-42.0&lang=en-US&os=linux64'
$ wget --no-verbose -O /tmp/firefox-42.0.tar.bz2 $FIREFOX_SOURCE_URL
$ tar xvC ~/. -f /tmp/firefox-42.0.tar.bz2
ln -s ~/firefox/firefox ~/bin/firefox

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 reference


7
7stud

After following ballPointPenguin's suggestion, I can now use watir-webdriver to retrieve local files, or files in my local apache install's htdocs directory, or files on the web:

1) file:///Users/me/jquery_programs/1.htm
2) 'http://localhost:8080/my.html'
3) 'http://www.google.com'

require 'watir-webdriver'

browser = Watir::Browser.new :firefox
browser.goto 'http://localhost:8080/my.html'

Before updating, I was getting the error:

`connect_until_stable': unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium::WebDriver::Error::WebDriverError)


This is not an answer for this question.

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now