【问题标题】:Unable to run Selenium tests on CentOS through Xvfb无法通过 Xvfb 在 CentOS 上运行 Selenium 测试
【发布时间】:2020-06-15 10:40:21
【问题描述】:

我正在通过 Jenkins 管道在 CentOS 7 机器上运行 Selenium 测试,因此使用 Xvfb。当使用 screen 参数和任何有效值时,如下 -

wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x8']) { 
   <code to run Selenium test here>
}

导致以下错误 -

[testng] org.openqa.selenium.WebDriverException: chrome not reachable

   [testng]   (Session info: chrome=80.0.3987.132)

   [testng]   (Driver info: chromedriver=80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}),platform=Linux 3.10.0-862.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)

   [testng] Command duration or timeout: 0 milliseconds

   [testng] Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'

 

如果我们在没有screen 参数的情况下运行它,它会成功运行。

另外一个观察 - 使用 screen 参数,它完全适用于 Ubuntu 18

请帮助我如何在 CentOS 7 上使用 screen 参数运行 Selenium 测试。

【问题讨论】:

    标签: selenium jenkins selenium-webdriver jenkins-pipeline xvfb


    【解决方案1】:

    在尝试为 screen 参数设置不同的值后,我意识到这不是 Chrome 浏览器或驱动程序的问题,而是将值传递给 screen

    当我将深度值从 8 更改为 16 时,Selenium 执行成功开始 - screen: '1440x800x16'

    wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x16']) { 
       <code to run Selenium test here>
    }
    

    但从技术上讲,我不明白为什么会出现这个错误以及深度值如何帮助解决它。

    【讨论】:

      猜你喜欢
      • 2016-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-02
      • 2011-10-18
      • 1970-01-01
      • 2015-03-12
      • 1970-01-01
      相关资源
      最近更新 更多