Are you looking to automate tests with Selenium but can’t get the correct version of ChromeDriver? You’re not alone.
Many testers and developers are struggling with errors like:
❌ SessionNotCreatedException: This version of ChromeDriver only supports Chrome version X
❌ chromedriver executable needs to be in PATH
Here is the solution.
This article will teach you how to download, install, and set up ChromeDriver for Selenium in Windows, Linux, and MAC OS (without errors).
Step 1: Check Your Chrome Version
It is necessary to check your Chrome version before downloading chromedriver.
How to Check Chrome Version
- Open Google Chrome.
- Type chrome://settings/help in the address bar.
- Look for the Version Number (e.g., My current chrome browser version: 133.0.6943.142)
Why does this matter?
Because ChromeDriver must match your Chrome version. If they do not match, you might get an error when executing your Selenium test.
Tips: Always use the latest version of Google Chrome and a latest stable release version of Chromedriver to minimize errors.
Learn a detailed guide on what is WebDriver in Selenium.
Step 2: Download the Correct ChromeDriver
Now, let’s download the right version of ChromeDriver.
Find the ChromeDriver version that matches your Chrome browser and OS, and download the right file for your system:
Choose your OS:
- Windows: chromedriver-win64.zip
- Mac (Intel or ARM): chromedriver-mac-x64.zip / chromedriver-mac-arm64.zip
- Linux: chromedriver-linux64.zip
Copy URL from the table as per your OS and Chrome browser’s version and open it in the browser. It will download the Zip file.
Once downloaded, extract the ZIP file to get the chromedriver executable.
Tip: Store chromedriver in a folder from where you can access it easily, like D:/chromedriver/
Step 3: Install and Set Up ChromeDriver in Selenium
Now that you have ChromeDriver, but Selenium doesn’t know where it is. You need to tell Selenium where to find it.
There are two options.
Option 1: Set Chromedriver Path in Environment Variable
- Search for Edit the system environment variables from Windows search.
- Click on Environment Variable button from Advanced tab.
- Select Path from System Variables section and click on Edit button.
- Click on the New button and set Chromedriver Path as shown in the image below and click OK.
That’s it.
Option 2: Specify ChromeDriver Path in Code
If you don’t want to modify system settings, you can also manually set the path in Selenium code. Here is an example:
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("https://only-testing-blog.blogspot.com/");
Note: Replace “D:\\chromedriver.exe” with the path where you extracted ChromeDriver.
The Easy Way – Use WebDriver Manager
It is annoying to download ChromeDriver and all other drivers manually every time the browser version updates. Instead of manually downloading ChromeDriver, let WebDriver Manager handle everything:
Here’s a way:
Install WebDriver Manager in Eclipse
If you are using Java with Eclipse, you can create a Maven Project and add WebDriver Manager Dependencies in the pom.xml file:
Now, you can use WebDriver Manager in your Selenium tests.
// Automatically download and setup ChromeDriver
WebDriverManager.chromedriver().setup();
// Launch Chrome browser
WebDriver driver = new ChromeDriver();
Troubleshooting Common ChromeDriver Errors
Error: SessionNotCreatedException – ChromeDriver version mismatch
Fix: Download the correct ChromeDriver version matching your Chrome browser.
Error: chromedriver executable needs to be in the PATH
Fix: Add ChromeDriver to the system PATH or specify its full path in your code.
Error: selenium.common.exceptions.WebDriverException
Fix: Update ChromeDriver or use WebDriver Manager.
Frequently Asked Questions (FAQs)
Question: Where can I download ChromeDriver?
Question: How do I check my Chrome version?
Answer: Go to chrome://settings/help, and your Chrome version will be displayed.
Question: How do I fix the “ChromeDriver executable needs to be in PATH” error?
Answer: Either add ChromeDriver to your system environment variable PATH or specify its full path in your Selenium script.
Question: What is the easiest way to install ChromeDriver?
Answer: Use WebDriver Manager. It will automatically download and update ChromeDriver.
Now you’re all set to run Selenium tests without errors!
Have any issues? Drop a comment below!