Reputation: 33
I have some JUnit tests written that use Selenium and the WebDriver of Chrome version 76.0.3809.68. Everything works fine when I execute the maven module with mvn clean install, but when I try to run it in a Jenkins job I get the following error:
The driver is not executable: /jenkins/workspace/webUI.ITests/target/test-classes/calculator/chromedriverunix
Now I already tried doing the same with a chromedriver.exe file, but I get the same error. Both of the drivers are from the selenium website and should be the correct ones. This is the code with which I am setting the drivers:
if (System.getenv("ON_JENKINS") == null) {
URL res = this.getClass().getResource("chromedriverunix");
File file = Paths.get(res.toURI()).toFile();
return file.getAbsolutePath();
} else {
URL res = this.getClass().getResource("chromedriver.exe");
File file = Paths.get(res.toURI()).toFile();
return file.getAbsolutePath();
}
Both of the files are certainly present in the build. Thank you in advance!
Upvotes: 0
Views: 166
Reputation: 934
This seems to be related to permissions on Unix. You can change it by executing chmod 777 chromedriverunix
or chmod +x chromedriverunix
in the folder where chromedriver is located.
Upvotes: 1