【问题标题】:Selenium Webdriver Tests fail on Jenkins(**Linux**) "The driver is not executable"Jenkins 上的 Selenium Webdriver 测试失败(**Linux**)“驱动程序不可执行”
【发布时间】:2016-01-28 06:06:00
【问题描述】:

我正在尝试在 Linux 上使用 jenkins 构建我的 maven 项目,但我的 selenium 测试失败并出现此异常

运行测试套件 配置TestNG:org.apache.maven.surefire.testng.conf.TestNG652Configurator@61db2215 测试运行:6,失败:1,错误:0,跳过:5,经过时间:0.51 秒

我知道我在 windows 上使用了 selenium webdriver 而不是 linux。 “ java.lang.IllegalStateException: The driver is not executable” error is coming when TestNG test cases run on Jenkins install on ubuntu 14.1 我想让它在linux机器上运行,但我对它并没有太多经验。我该如何解决?谢了

【问题讨论】:

    标签: java linux jenkins selenium-webdriver


    【解决方案1】:

    使用

    使 chromedriver 文件可执行

    chmod +x chromedriver

    同时从构建中移除 ma​​ven clean,因为它会重置

    【讨论】:

    • stackoverflow.com/questions/64462100/… 我做了这些步骤仍然得到同样的错误你能帮我吗?我们的 Jenkins 服务器在 linux 服务器上运行,我的机器是 Mac。并且测试脚本在本地运行而不是在 Jenkins 中运行
    【解决方案2】:

    首先你需要在 POM.xml 中添加 chrome webdriver 依赖:

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>2.48.2</version>
    </dependency>
    

    那么你就可以使用它了:

     System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
     WebDriver driver = new ChromeDriver();
    

    你可以找到更详细的:link

    【讨论】:

      猜你喜欢
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-16
      • 2013-10-16
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      相关资源
      最近更新 更多