Ruby-无法在45秒内绑定到锁定端口7054(Selenium :: WebDriver :: Error :: WebDriverError)

Ruby-无法在45秒内绑定到锁定端口7054(Selenium :: WebDriver :: Error :: WebDriverError)

问题描述:

我最近在尝试运行任何Cucumber测试时开始看到此错误消息。我进行了一些研究,发现了此错误的其他一些类似实例,但大多数都是与浏览器相关的问题。我在此输出中未看到任何浏览器特定的错误消息:

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)

我在此处看到了另一个已回答的问题( Selenium Webdriver异常),但是该解决方案对我不起作用。运行 lsof -i TCP:7054 不会产生任何输出。

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)

当然,我也尝试过使用Firefox 3.6、4.0和5.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.

不是阴谋论者或其他任何人,但是在我手动退出运行测试套件并对所有活动组件运行pkill之前,一切工作正常Cucumber启动的Firefox进程。在测试套件中,我大约有9个Firefox实例同时运行。我不确定这是否会引起混乱,是否会产生通过运行Cucumber测试得到的结果。

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?

更新:问题已解决

之后将$ DEBUG设置为true并重新运行测试,此错误最有趣:

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

在查看platform.rb:131之后,我注意到它正在尝试连接到端口80上的 localhost,但是失败了。这引起了一个危险信号,因为我最近无法通过浏览器访问 localhost,而不得不使用127.0.0.1:3000来查看我的rails项目。

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.

解决方案:

我在/ etc / hosts中缺少本地主机文件条目:

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.