Reputation: 61
I'm trying to build my maven project with jenkins on Linux, but my selenium tests fails with this exception
Running TestSuite Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@61db2215 Tests run: 6, Failures: 1, Errors: 0, Skipped: 5, Time elapsed: 0.51 sec <<< FAILURE! setup(selenium.TestSelenium) Time elapsed: 0.392 sec <<< FAILURE! java.lang.IllegalStateException: The driver is not executable: /var/lib/jenkins/jobs/Synapse Control Center/workspace/ControlCenterTests/./src/test/resources/driver/chromedriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:200) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:125) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116) 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:296) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at selenium.TestSelenium.setup(TestSelenium.java:43)
I understand that I used selenium webdriver for the windows not linux. “ java.lang.IllegalStateException: The driver is not executable” error is coming when TestNG test cases run on Jenkins install on ubuntu 14.1 And I want to make it running on linux machine, but I don't really have much experience with it. How exactly could I fix it? THX
Upvotes: 2
Views: 4845
Reputation: 81
Make chromedriver file executable using
chmod +x chromedriver
Also remove maven clean from build since it resets
Upvotes: 2
Reputation: 1
First you need add chrome webdriver dependency to POM.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.48.2</version>
</dependency>
then you can use it :
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
WebDriver driver = new ChromeDriver();
you can find it more detailed:link
Upvotes: -5