Chromedriver不能执行该驱动程序

时间:2017-11-10 22:05:39

标签: java selenium jenkins selenium-chromedriver

我已尝试设置chromedriver权限并将其标记为可执行文件。我也设置了PATH变量但仍然出现此错误。我可以采取哪些其他措施来解决问题?我在EC2 Linux实例上使用Git运行Jenkins。

java.lang.IllegalStateException: The driver is not executable: /var/lib/jenkins/workspace/Selenium TestNG ANT Build - Git/chromedriver.exe
    at com.google.common.base.Preconditions.checkState(Preconditions.java:534)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:140)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131)
    at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:339)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
    at WebDriver.TestNGScript.beforeTestsetUp(Unknown Source)
... Removed 22 stack frames

1 个答案:

答案 0 :(得分:1)

chromedriver.exe是Windows可执行文件,不适用于Linux。下载Linux版本,然后重试。

如果在下载Linux版chromedriver后仍然出现错误,请使用terminal / bash导航到包含驱动程序的目录并输入:

chmod +x chromedriver