0

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
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
user14887535
  • 13
  • 1
  • 6

1 Answers1

0

Though the downloaded zip file name is chromedriver_win32.zip, but once you extract the ChromeDriver it's chromedriver.exe

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");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352