在Linux Jenkins CI服务器上使用Xvfb的Firefox无头测试自动化

时间:2016-12-13 17:15:56

标签: ruby jenkins cucumber xvfb headless-browser

我正在尝试使用Xvfb和firefox来运行测试自动化无头。但是,我在启动xvfb时收到以下消息。



XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/cvms1247:99
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension SECURITY
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension Present
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension SELinux
Initializing built-in extension GLX




然后我尝试了以下命令:

  Xvfb :001 -nolisten inet6
  export http_proxy=http-proxy.nwie.net:8080

以下消息消失了。

  XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
 _XSERVTransOpen: transport open failed for inet6/cvms1247:99
 _XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

无头的使用:

  if OS::windows? || ENV['PhantomJS'] == 'true'
    browser = Selenium::WebDriver.for :remote, url: 'http://localhost:8001'
  elsif OS::linux?
    require 'headless'
    headless = Headless.new
    headless.start
    browser = Selenium::WebDriver.for :firefox
    at_exit do
      browser.close
      headless.destroy
    end
  else
    raise 'Unknown OS'
  end

环境:

 Ruby: 1.9.3
 Jenkins: 1.58
 Selenium webdriver: 2.53
 headless: 2.3.1
 Xvfb: yum install xorg-x11-server-Xvfb
 firefox: 33.0
 Linux: 2.6.32-573.12.1.el6.x86_64

我错过了什么?

1 个答案:

答案 0 :(得分:0)

没有错误,或者您忘记包含它。

您发布的示例输出中不包含“错误”一词。

您可能会被“无法打开inet6的套接字”消息误导。对我而言,这看起来像是xv服务器不会使用ipv6的信息性消息。在成功之后初始化,所以很可能ipv4工作正常或者什么。