Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby - unable to bind to locking port 7054 within 45 seconds (Selenium::WebDriver::Error::WebDriverError)

I recently started seeing this error message when trying to run any Cucumber tests. I've done some research and found a few other similar instances of this error, but most of them were browser related issues. I don't see any browser specific error messages in this output:

unable to bind to locking port 7054 within 45 seconds (Selenium::WebDriver::Error::WebDriverError)

I saw another question posted here that was answered (A selenium webdriver exception), however that solution didn't work for me. Running "lsof -i TCP:7054" does not produce any output.

Just in case anyone suggests this, I have already restarted my machine several times and have wiped my gemset and re-ran "bundle".

Here are the relevant gems I'm using:

capybara (0.4.1.2)
cucumber (0.10.7)   
cucumber-rails (0.4.1)
fuubar-cucumber (0.0.9)
selenium-webdriver (0.2.0)

Just to be sure, I've also tried running these tests with Firefox 3.6, 4.0, and 5.0. Same message every time.

Not to be a conspiracy theorist or anything, but everything was working fine before I manually exited running my test suite and ran a pkill on all the active Firefox processes that Cucumber started up. I had about 9 Firefox instances running simultaneously during the test suite. I'm not sure if this would have caused something messed up to happen that would produce the results I'm seeing now from running Cucumber tests.

Does anyone have any suggestions for fixing this issue?

like image 719
Joel Andritsch Avatar asked Jul 26 '11 16:07

Joel Andritsch


1 Answers

Update: Problem Solved

After setting $DEBUG to true and re-running the tests, this error was most interesting:

<Selenium::WebDriver::Firefox::SocketLock:0x00000102f9c010>: getaddrinfo: nodename nor servname provided, or not known
Exception `SocketError' at /Users/bobrossasaurus/.rvm/gems/ruby-1.9.2-p136/gems/selenium-webdriver-0.2.0/lib/selenium/webdriver/common/platform.rb:131 - getaddrinfo: nodename nor servname provided, or not known

After taking a look at platform.rb:131, I noticed that it was attempting to connect to "localhost" on port 80 but was failing. This raised a red flag, as I was recently having trouble accessing "localhost" via browser and instead had to use 127.0.0.1:3000 to view my rails projects.

The Solution:

I was missing the localhost host file entry in /etc/hosts:

127.0.0.1 localhost

Quite an embarrassing issue, but it was the answer nonetheless.

like image 177
Joel Andritsch Avatar answered Oct 18 '22 08:10

Joel Andritsch