0

I am getting this error and unable to find solution of this issue, I am working with MAC, and same proper working in Windows.

when I calling browser then error message display on sceen. This is my code.

package Testmavenproject.Project;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Testing {

    public static void main(String[] args) 
    {
        System.setProperty("webdriver.chrome.driver","/Project/Driver/chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.qr-code-generator.com/");

    }

}

Getting error :

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /Project/Driver/chromedriver at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:137) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:132) at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:156) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:91) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Testmavenproject.Project.Testing.main(Testing.java:11)

demouser123
  • 4,108
  • 9
  • 50
  • 82
Saurabh Gupta
  • 139
  • 2
  • 4
  • 13
  • Please correct your path and provide absolute path.. not a relative one. It should be something like `/Users//path_to_chromedriver`. You can right click on the chromedriver executable and find the path in there. – demouser123 Dec 09 '19 at 06:48
  • @demouser123 bro same issue after adding absolute path public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","/Users/saurabh.gupta/eclipse-workspace/Project/Driver/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.qr-code-generator.com/"); } – Saurabh Gupta Dec 09 '19 at 06:52
  • 1
    Also, `.exe` doesn't work on Macintosh machines. You need to change the permissions too using `chmod`. – demouser123 Dec 09 '19 at 06:53
  • @demouser123 can you plz let me know how to change then permission too using chmod Thanks, – Saurabh Gupta Dec 09 '19 at 06:56
  • Google will be your guide. It's a fairly common procedure/command. – demouser123 Dec 09 '19 at 06:59

1 Answers1

0

If you are on mac, then ".exe" doesn't work. Make sure you have chromedriver for mac. It should be "chromedriver" without .exe

Ayaz
  • 249
  • 1
  • 2
  • 11