秒内绑定到锁定端口

秒内绑定到锁定端口

本文介绍了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)

我看到这里发布的另一个问题得到了回答(A selenium webdriver exception),但是该解决方案对我不起作用.运行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.

以防万一有人建议这样做,我已经多次重新启动我的机器并擦除了我的 gemset 并重新运行捆绑包".

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.

不要成为阴谋论者或任何人,但在我手动退出运行我的测试套件并在 Cucumber 启动的所有活动 Firefox 进程上运行 pkill 之前,一切正常.在测试套件期间,我有大约 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 中缺少 localhost 主机文件条目:

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.

这篇关于Ruby - 无法在 45 秒内绑定到锁定端口 7054 (Selenium::WebDriver::Error::WebDriverError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:28