Chrome Driver Version (126) – Can’t Find the Chromedriver.exe? Don’t Panic!
Image by Nektario - hkhazo.biz.id

Chrome Driver Version (126) – Can’t Find the Chromedriver.exe? Don’t Panic!

Posted on

Welcome to the troubleshooting guide for one of the most frustrating errors in the world of Selenium automation: “Chrome driver version (126) – can’t find the chromedriver.exe”. You’re probably here because you’ve encountered this issue and are desperate for a solution. Worry not, friend, for we’ve got you covered!

What’s the deal with Chromedriver.exe?

Before we dive into the solutions, let’s quickly understand what Chromedriver.exe is and why it’s essential for Selenium automation. Chromedriver.exe is a standalone executable that acts as a bridge between your Selenium script and the Chrome browser. It’s responsible for controlling the browser, allowing you to automate tasks, and extract data.

Chromedriver.exe is usually downloaded automatically when you install Selenium, but sometimes, it can get lost in the sauce, leading to the error message we’re trying to fix.

The Error Message: A Deeper Dive

When you encounter the “Chrome driver version (126) – can’t find the chromedriver.exe” error, it usually means one of two things:

  • The Chromedriver.exe file is missing or corrupted.
  • The system can’t find the Chromedriver.exe file due to incorrect configuration or path issues.

In both cases, we’ll need to troubleshoot and resolve the issue to get our automation script up and running.

Solution 1: Verify Chromedriver.exe Installation

Let’s start by checking if Chromedriver.exe is installed correctly:

  1. Open a new Command Prompt or Terminal window.
  2. Navigate to the folder where you installed Selenium. Typically, it’s located in C:\Users\YourUsername\AppData\Local\Selenium.
  3. Look for the Chromedriver.exe file. If it’s not there, proceed to the next step.
  4. Download the correct version of Chromedriver.exe from the official Chromedriver download page.
  5. Extract the downloaded zip file to the Selenium installation folder.
C:\Users\YourUsername\AppData\Local\Selenium
chromedriver.exe
chromedriver.bat

Once you’ve verified that Chromedriver.exe is installed, try running your automation script again. If the error persists, move on to the next solution.

Solution 2: Update System Environment Variables

Sometimes, the system can’t find Chromedriver.exe due to incorrect environment variable settings. Let’s update the system environment variables:

  1. Right-click on the Start menu (Windows) or System Preferences (Mac) and select System.
  2. Click on Advanced system settings.
  3. Click on Environment Variables.
  4. Under the System Variables section, scroll down and find the Path variable, then click Edit.
  5. Click New and add the path to the Chromedriver.exe file (e.g., C:\Users\YourUsername\AppData\Local\Selenium).
  6. Click OK to close all the windows.

Restart your command prompt or terminal and try running your automation script again. If the error persists, it’s time to dig deeper.

Solution 3: Specify ChromeDriver Location in Code

Instead of relying on the system environment variables, we can specify the Chromedriver.exe location directly in our code:

For Java:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\YourUsername\\AppData\\Local\\Selenium\\chromedriver.exe");
WebDriver driver = new ChromeDriver();

For Python:

from selenium import webdriver

driver = webdriver.Chrome(executable_path="C:\\Users\\YourUsername\\AppData\\Local\\Selenium\\chromedriver.exe")

For C#:

using OpenQA.Selenium.Chrome;

var driver = new ChromeDriver(@"C:\Users\YourUsername\AppData\Local\Selenium");

Replace the path with the actual location of your Chromedriver.exe file.

Solution 4: Check Chrome Browser Version

Make sure you’re running a compatible version of the Chrome browser with the installed Chromedriver.exe:

Check your Chrome browser version:

chrome://version/

Compare it with the Chromedriver.exe version:

chromedriver --version

If the versions don’t match, update Chromedriver.exe to the correct version or downgrade Chrome browser to a compatible version.

Solution 5: Reinstall Selenium and Chromedriver.exe

If all else fails, it’s time to start from scratch. Reinstall Selenium and Chromedriver.exe:

  1. Uninstall Selenium and Chromedriver.exe.
  2. Delete the Selenium installation folder.
  3. Reinstall Selenium and Chromedriver.exe from the official websites.
  4. Verify that Chromedriver.exe is installed correctly.

Conclusion

By following these solutions, you should be able to resolve the “Chrome driver version (126) – can’t find the chromedriver.exe” error and get your automation script up and running. Remember to stay calm, patient, and methodical in your troubleshooting approach.

Solution Description
Verify Chromedriver.exe Installation Check if Chromedriver.exe is installed correctly and download the correct version if necessary.
Update System Environment Variables
Specify ChromeDriver Location in Code
Check Chrome Browser Version Ensure the Chrome browser version is compatible with the installed Chromedriver.exe.
Reinstall Selenium and Chromedriver.exe Reinstall Selenium and Chromedriver.exe as a last resort.

If you’ve reached this point and the error still persists, it’s likely a unique issue specific to your setup. Feel free to share your experience and troubleshooting journey in the comments below. We’re here to help!

Frequently Asked Question

Having trouble with ChromeDriver version 126? Don’t worry, we’ve got you covered! Check out these FAQs to resolve the issue.

Why can’t I find the chromedriver.exe file?

Make sure you’ve downloaded the correct version of ChromeDriver that matches your Chrome browser version. You can check the version by going to chrome://version/ in your browser. Also, ensure that you’ve unzipped the downloaded file and the chromedriver.exe file is in the correct location.

How do I know which ChromeDriver version I need?

You can check the ChromeDriver version you need by going to the ChromeDriver download page and matching your Chrome browser version with the corresponding ChromeDriver version. For example, if you’re using Chrome browser version 102, you’ll need ChromeDriver version 102.

Why is ChromeDriver not working even after installing the correct version?

Ensure that the chromedriver.exe file is in your system’s PATH environment variable. You can do this by right-clicking on the file, selecting ‘Properties’, and then adding the file location to the PATH variable. Restart your system or command prompt after making the changes.

Can I use a ChromeDriver version lower than 126?

While it’s technically possible, we strongly advise against using an older version of ChromeDriver. ChromeDriver version 126 is specifically designed to work with Chrome browser version 102 and later. Using an older version may lead to compatibility issues and errors.

What if I’m still facing issues after trying the above solutions?

Don’t worry! If you’ve tried the above solutions and still can’t get ChromeDriver to work, try reinstalling ChromeDriver, or seek help from the ChromeDriver community forums or GitHub page. You can also consider seeking help from a developer or IT professional if you’re still stuck.

Leave a Reply

Your email address will not be published. Required fields are marked *