net.thucydides.core.webdriver.UnsupportedDriverException: 无法实例化 class org.openqa.selenium.firefox.FirefoxDriver

net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate class org.openqa.selenium.firefox.FirefoxDriver

我正在使用 mac mojave 10.14.3、JDK 1.8、Serenity core 2.0.40(最新)来开发我的测试用例。他们都 运行 完美地与 Chrome 版本。 73(100% 的时间)或 Firefox 版本。在我的本地 mac 系统上为 65.0(99% 的时间)。 我们的 Jenkins 运行 正在 Redhat linux 上运行,没有 GUI。我们安装了 Firefox 浏览器(Firefox 版本 60.5.0 可能是最新可用的),因为 Chrome 不支持/不适用于 RH Linux。当我合并代码并要求我的管理员在 Jenkins 上 运行 git b运行ch 时,我总是会出错。

I have these in my project code itself: Selenium-java :3.141.59

Selenium-api: 3.141.59

Selenium-server: 3.141.59

geckodriver:0.24.0

chromedriver:2.45.615355

今天在我的本地 Mac 系统上 运行 每次测试 运行 100% 通过后,在 Jenkins(RH Linux 框)上 运行 我收到此错误( 运行 2 次)。

 net.thucydides.core.webdriver.UnsupportedDriverException: Could not
 instantiate class org.openqa.selenium.firefox.FirefoxDriver    at
 net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:154)
 Caused by: net.thucydides.core.webdriver.UnsupportedDriverException:
 Could not instantiate new WebDriver instance of type class
 org.openqa.selenium.firefox.FirefoxDriver (Timed out waiting 45
seconds for Firefox to start. Build info: version: '3.141.59',
 revision: 'e82be7d358', time: '2018-11-14T08:17:03'

 Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
45 seconds for Firefox to start. Build info: version: '3.141.59',
 revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
 'xxx', ip: 'xxx', os.name: 'Linux', os.arch: 'amd64', os.version:
 '3.10.0-957.5.1.el7.x86_64', java.version: '1.8.0_202' Driver info:
 driver.version: FirefoxDriver

 Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
 45 seconds for Firefox to start. Build info: version: '3.141.59',
 revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
 'xxx', ip: 'xxx', os.name: 'Linux', os.arch: 'amd64', os.version:
 '3.10.0-957.5.1.el7.x86_64', java.version: '1.8.0_202' Driver info:
 driver.version: FirefoxDriver  at
 org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:247)

*********可能是一个错误??????**

 According to this page, [Serenity BDD Book]https://serenity-bdd.github.io/theserenitybook/latest/web-testing-in-serenity.html 

我准备了 config.properties 文件作为...

Chrome 浏览器无头测试

    webdriver.driver=chrome
    headless.mode = true
    drivers.windows.webdriver.chrome.driver = 
       src/test/resources/webdriver/windows/chromedriver.exe
    drivers.mac.webdriver.chrome.driver = 
       src/test/resources/webdriver/mac/chromedriver
    drivers.linux.webdriver.chrome.driver = 
        src/test/resources/webdriver/linux/chromedriver

Firefox 浏览器无头测试

      webdriver.driver=firefox
      gecko.firefox.options = {"args": ["-headless"]}
      drivers.mac.webdriver.gecko.driver = 
         src/test/resources/webdriver/mac/geckodriver
      drivers.linux.webdriver.firefox.driver = 
         src/test/resources/webdriver/linux/geckodriver

但是我遇到了上面报告的问题 UnsupportedDriverException: 我需要说的是,一切都在我的本地 Mac 系统上完美运行,但在装有 Firefox 浏览器 60.5 版本(应该与 geckodriver 0.24.0 一起工作)的 RedHat Linux 机器上却不行

但是我们的 Jenkins 系统管理员将 geckodriver 添加到系统路径,然后它工作了!!!!!!! 我们的 Jenkins 服务器是 运行 on RedHat Linux.