'chromedriver does not have .exe after extracting
I have downloaded te latest chromedriver 2.46 and extracted the chrome driver but it has no .exe extension and when i run the code the error appears, i also tried using 7zip when extracting.
Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Drivers\chromedriver_win32\chromedriver
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SelTest {
public static void main(String [] args ) throws Exception {
System.setProperty("webdriver.chrome.driver","C:\\Drivers\\chromedriver_win32\\chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
driver.manage().window().maximize();
Thread.sleep(5000);
driver.close();
}
}
Solution 1:[1]
Please add .exe in the chromedriver path and then it would work.
Like:System.setProperty("webdriver.chrome.driver","C:\\Drivers\\chromedriver_win32\\chromedriver.exe");
Solution 2:[2]
Your Windows Explorer is configured not to show known file extension - this includes ".exe". See also the archives in your screenshot - they also don't have their ".zip" :)
Just set as environment variable the chromedriver with the .exe appended at the end, and you'll be fine:
System.setProperty("webdriver.chrome.driver","C:\\Drivers\\chromedriver_win32\\chromedriver.exe");
And here's a (random from the net) pic how to make Explorer show the extensions:
(source: netdna-ssl.com)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sameer Arora |
Solution 2 | Glorfindel |