So i'm trying to to learn Selenium and encountered a problem. Can't run chromedriver.
Error:
Exception in thread "main" java.lang.IllegalStateException: The driver is not executable: /Users/Roberto/Documents/EclipseProjects/MansPirmaisSelenium/lib/chromedriver
Code:
System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"//lib//chromedriver");
WebDriver chromeDriver = new ChromeDriver();
chromeDriver.get("http://www.google.lv");
I have my chromedriver in the right path i guess, here is the image.
To solve the Selenium error "WebDriverException: Message: 'chromedriver' executable needs to be in PATH", install and import the webdriver-manager module by running pip install webdriver-manager . The module simplifies management of binary drivers for different browsers.
There might be two possibilities for this error. First, the path of the exe file may not be correct or secondly chrome driver may not be compatible with your chrome browser[incompatibility related issue]. 1. Copy chrome drive into your local file directory say test folder in D drive.
The IllegalStateException is thrown when the Java environment or application is not in an appropriate state for the requested operation. This can occur when dealing with threads or the Collections framework of the java. util package under specific conditions.
I assume you just downloaded the chromedriver application, in which case you simply have to mark it as executable in Unix:
chmod +x chromedriver
If you can run the application yourself from the terminal, then WebDriver should be able to as well.
By the way, I wouldn't include chromedriver
inside your project:
include the ChromeDriver location in your PATH environment variable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With