在无头centOS上使用firefox 23无法在60秒内获得稳定的firefox连接

时间:2013-08-26 17:51:04

标签: ruby cucumber selenium-webdriver watir-webdriver headless

我正试图在我们的无头centOS盒子上运行黄瓜测试。 我已经安装了Xvfb,firefox和我的测试套件,它们在我们的无头(头?)机器上运行。

版本

CentOS: 6.2
firefox: 23.0.1
headless: 1.0.1
selenium-webdriver: 2.35.0
watir-webdriver: 0.6.4
ruby: 1.9.3

在irb:

1.9.3-p448 :001 > require 'watir-webdriver'
 => true
1.9.3-p448 :002 > require 'headless'
 => true
1.9.3-p448 :004 > headless = Headless.new
 => #<Headless:0x000000025e0860 @display=99, @autopick_display=true, @reuse_display=true, @dimensions="1280x1024x24", @video_capture_options={}, @destroy_at_exit=true>
1.9.3-p448 :005 > headless.start
 => #<Proc:0x000000025e5180@/usr/local/rvm/gems/ruby-1.9.3-p448/gems/headless-1.0.1/lib/headless.rb:175>
1.9.3-p448 :006 > b = Watir::Browser.new(:firefox)
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/firefox/launcher.rb:79:in `connect_until_stable'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/firefox/launcher.rb:37:in `block in launch'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/firefox/socket_lock.rb:20:in `locked'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/firefox/bridge.rb:24:in `initialize'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/common/driver.rb:31:in `new'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver/common/driver.rb:31:in `for'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.35.0/lib/selenium/webdriver.rb:67:in `for'
        from /usr/local/rvm/gems/ruby-1.9.3-p448/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:46:in `initialize'
        from (irb):6:in `new'
        from (irb):6
        from /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/irb:13:in `<main>'

尝试运行测试时遇到同样的问题(这更容易重现)。

我在这里查看了其他问题,但我已经在使用最新版本了。根据{{​​3}}他们支持firefox 23.有没有人有任何想法?提前谢谢!

更新8/28/2013 0900: 我试图运行Xvfb时收到此错误。

[dix] Could not init font path element catalogue:/etc/X11/fontpath.d, removing from list!
[dix] Could not init font path element built-ins, removing from list!

我使用

修复了它
yum -y install libXfont

但我仍然遇到同样的错误。

更新8/28/2013 0930: 根据TDHM的建议,我通过运行

将firefox降级到17.0.8
yum downgrade firefox

但我仍然遇到同样的错误。

2 个答案:

答案 0 :(得分:6)

我的一位同事设法解决了这个问题。 运行以下代码:

$ dbus-uuidgen > /var/lib/dbus/machine-id

问题是解决的。 This是修复

的来源

答案 1 :(得分:1)

我不确定,但看看降级Firefox版本是否有效。因为很多时候最新版本的Selenium都遇到了最新浏览器版本的问题。