Jenkins : Ubuntu 16.04 : Headless Chrome 启动失败:异常退出

Jenkins : Ubuntu 16.04 : Headless Chrome failed to start: exited abnormally

jenkins@ubuntu:~$ which chromedriver /usr/local/bin/chromedriver

ChromeDriver 2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac)

我正在尝试 运行 来自 Jenkins 的一些 Robot 框架脚本。我的机器人脚本 运行 在 Ubuntu16.04 版本的机器上是无头的。

每当我 运行 我的测试用例甚至一个简单的 selenium 脚本时,它都会给我以下错误:

>>> from selenium import webdriver
    we = webdriver.Chrome()
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/var/lib/jenkins/.local/lib/python2.7/site- 
    packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
    File "/var/lib/jenkins/.local/lib/python2.7/site- 
    packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
   self.start_session(capabilities, browser_profile)
   File "/var/lib/jenkins/.local/lib/python2.7/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 252, in 
   start_session
   response = self.execute(Command.NEW_SESSION, parameters)
   File "/var/lib/jenkins/.local/lib/python2.7/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   self.error_handler.check_response(response)
   File "/var/lib/jenkins/.local/lib/python2.7/site- 
   packages/selenium/webdriver/remote/errorhandler.py", line 242, in 
   check_response
   raise exception_class(message, screen, stacktrace)
   selenium.common.exceptions.WebDriverException: Message: unknown 
   error: Chrome failed to start: exited abnormally
   (unknown error: DevToolsActivePort file doesn't exist)
   (The process started from chrome location /usr/bin/google-chrome is 
    no longer running, so ChromeDriver is assuming that Chrome has 
   crashed.)
   (Driver info: chromedriver=2.42.591071 
  (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-87- 
  generic x86_64)

For running it headless I am doing the following : Xvfb -ac :90 -screen 0 1280x1024x16 & export DISPLAY=:90

如能帮助解决此问题,我们将不胜感激。

提前致谢!

为解决此问题,我已将 google-chrome 版本降级为 57.0.2987.133 和 chrome 驱动程序版本 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac)。

似乎较新版本的 chrome 驱动程序和 google-chrome 有一些问题 运行 它们在 ubuntu 14.04 机器人脚本中无头.

对于运行,我使用的是无头的:

Xvfb -ac :90 -screen 0 1280x1024x16 & 导出显示=:90