Home > database >  Exception in thread "main" java.lang.IllegalStateException: The driver executable must exi
Exception in thread "main" java.lang.IllegalStateException: The driver executable must exi

Time:11-23

I'm facing java.lang.IllegalStateException executing my code.

Code trials:

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

public class seleniumintroduction {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver","C:\\Users\\ATIF\\OneDrive\\Desktop\\Selenium Course\\chromedriver_win32.exe");
        WebDriver driver=new ChromeDriver();
    }
 }

Error I'm seeing:

Exception in thread "main" java.lang.IllegalStateException: The driver executable must exist: C:\Users\ATIF\OneDrive\Desktop\Selenium Course\chromedriver_win32.exe

CodePudding user response:

Though the downloaded zip file name is chromedriver_win32.zip, but once you extract the ChromeDriverExecutable

So you need to change the line:

System.setProperty("webdriver.chrome.driver","C:\\Users\\ATIF\\OneDrive\\Desktop\\Selenium Course\\chromedriver_win32.exe");

as

System.setProperty("webdriver.chrome.driver","C:\\Users\\ATIF\\OneDrive\\Desktop\\Selenium Course\\chromedriver.exe");

CodePudding user response:

Course\\chromedriver_win32.exe" it should ends with chromedriver.exe you are referring the downloaded zip file location so unzip that and use the correct file location.

  • Related