org.openqa.selenium.SessionNotCreatedException 因为 "Chrome version must be >= 64.0.3282.0" 尽管 Travis 上的版本是 65.0.3325.181 CI

org.openqa.selenium.SessionNotCreatedException because of "Chrome version must be >= 64.0.3282.0" although version is 65.0.3325.181 on Travis CI

当我试图通过设置 phantomjschromeheadless 浏览器驱动程序来扩展 Arquillian PrimeFaces.travis.yml 以使用 Selenium 进行功能测试时,我经历了

java.lang.RuntimeException: Could not create statement
Caused by: java.lang.RuntimeException: 
Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(Capabilities): org.openqa.selenium.SessionNotCreatedException: session not created exception: Chrome version must be >= 64.0.3282.0
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
Caused by: org.openqa.selenium.SessionNotCreatedException: 
session not created exception: Chrome version must be >= 64.0.3282.0
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.4.0-101-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 564 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'travis-job-bdbf5b81-b2fa-4377-b5de-da7743f04986', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-101-generic', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver

所以,我用 sudo add-apt-repository --yes ppa:saiarcot895/chromium-dev && sudo apt-get update && sudo apt-get install --yes chromium-browser 更新了 chromium-browser 并验证它是唯一的 Chrome 二进制文件,并且具有与 which -a chromium-browser && chromium-browser --version 匹配的版本,这表明唯一的二进制文件是/usr/bin/chrominum-browser 版本为 65.0.3325.181。但是,错误仍然存​​在。

我在 Travis CI 上研究并发现了 Chrome 的问题,比如

并检查了 the Arquillian web driver configuration options for Chrome,其中似乎不包含一个以暴露幽灵 64.x 二进制文件的实际拾取。

可以在 https://travis-ci.org/krichter722/arquillian-primefaces/jobs/364342730 找到失败的示例 运行。

在你的问题中你提到了使用 Chrome v65.0.3325.181 但是错误堆栈 strace 显示不同的版本如下:

Caused by: org.openqa.selenium.SessionNotCreatedException: 
session not created exception: Chrome version must be >= 64.0.3282.0

这实质上意味着 ChromeDriver 无法检测 chrome 二进制文件的正确版本。您似乎已经安装了 Chrome 浏览器的多个实例,并且在您的系统中有多个 chrome 二进制文件实例,或者您的系统中有多个 chrome 二进制文件的离群实例。

解决方案

  • 您必须确保 Chrome 安装在最佳位置,因为服务器希望您拥有 Chrome 按照下面的快照安装在每个系统的默认位置:

注意:对于Linux系统,Chrome驱动程序期望/usr/bin/google-chrome指向实际 Chrome 二进制文件的符号链接。您还可以按照文档 Using a Chrome executable in a non-standard location.

覆盖 Chrome 二进制位置
  • 清理你的项目工作区通过你的IDE重建你的项目只需要依赖。
  • 使用 CCleaner 工具清除执行 测试套件 .
  • 前后的所有 OS 琐事
  • 如果您的基础 Web Client 版本太旧,则通过 Revo Uninstaller 卸载它并安装最新的 GA 和发布版本的 Web Client .
  • 系统重启
  • 执行你的@Test.