0

I have jenkins which is running on Linux box and Whenever I tried to run the below script its failing and says the driver is not executable.

  java.lang.IllegalStateException: The driver is not executable: /COMPLIANCE-48/workspace/AutoProfile_Exec/Driver/chromedriver
  at com.google.common.base.Preconditions.checkState(Preconditions.java:199)

Code:

        String getLocation=System.getProperty("chromePath");
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--headless");
        System.setProperty("webdriver.chrome.driver",getLocation);
        WebDriver iDriver = new ChromeDriver(chromeOptions);

The below is mvn command:

-U clean compile exec:java -DchromePath="${WORKSPACE}/Driver/chromedriver"

Actually I have placed the chromedriver in that specific path and passing it as an argument. But not sure why it's saying driver is not executable.

ArrchanaMohan
  • 2,314
  • 4
  • 36
  • 84

2 Answers2

4

In linux and mac machines, we don't have the exe files like we have in windows so you need to make the driver executable by using the chmod +x command. Please go to the path where chromedriver is present and then execute the chmod +x command.

In your case it should be:

cd /COMPLIANCE-48/workspace/AutoProfile_Exec/Driver
chmod +x chromedriver

After running the above commands, try to run the code, it would work then.

Sameer Arora
  • 4,439
  • 3
  • 10
  • 20
2

Adding to @Sameer Arora answer, if his solution doesn't solve the problem then try to change -DchromePath to -Dwebdriver.chrome.driver like below:

-U clean compile exec:java -Dwebdriver.chrome.driver="${WORKSPACE}/Driver/chromedriver"

And make sure that the chromedriver is a executable driver file and not a directory or something else.

Check Mac OSX - IllegalStateException: The driver is not executable: for more information.

Ali
  • 1,689
  • 1
  • 5
  • 12