How to find a chrome driver for my chrome version?
Categories:
Finding the Right ChromeDriver for Your Chrome Version

A comprehensive guide to matching your Chrome browser version with the correct ChromeDriver for Selenium automation and web scraping.
When working with Selenium WebDriver for browser automation or web scraping, a common hurdle is ensuring that your ChromeDriver version is compatible with your installed Google Chrome browser version. Mismatched versions can lead to various errors, preventing your automation scripts from running. This article will guide you through the process of identifying your Chrome version and subsequently finding and downloading the appropriate ChromeDriver.
Understanding Chrome and ChromeDriver Versioning
Google Chrome and ChromeDriver follow a closely aligned versioning scheme. Typically, the major version number of ChromeDriver must match the major version number of your Chrome browser. For example, if your Chrome browser is version 120.x.y.z, you will need a ChromeDriver version 120.x.y.z. Minor version differences are usually tolerated, but it's always best practice to get the closest match possible.
flowchart TD A[Start: Automation Script] --> B{Check Chrome Version} B --> C[Identify Major Version (e.g., 120)] C --> D{Download ChromeDriver} D --> E[Extract ChromeDriver Executable] E --> F[Configure Selenium Path] F --> G[Run Script: Success!] D --> H{Version Mismatch?} H --> I[Error: Incompatible Versions] I --> J[End: Failure] G --> K[End: Success]
Workflow for ensuring Chrome and ChromeDriver compatibility
Step 1: Identify Your Google Chrome Browser Version
The first crucial step is to determine the exact version of Google Chrome installed on your system. This information is readily available within the browser itself.
1. Open Google Chrome
Launch your Google Chrome browser.
2. Access the 'About Chrome' Section
Click on the three vertical dots (⋮) in the top-right corner of the browser window to open the menu. Navigate to Help
> About Google Chrome
.
3. Note the Version Number
A new tab will open displaying your Chrome browser's version. It will look something like Version 120.0.6099.109 (Official Build) (64-bit)
. The most important part is the major version number (e.g., 120
).
google-chrome --version
or chromium-browser --version
in your terminal.Step 2: Finding the Correct ChromeDriver
Once you have your Chrome version, you can proceed to download the corresponding ChromeDriver. Google maintains an official repository for all ChromeDriver releases.
1. Visit the Official ChromeDriver Downloads Page
Go to the official ChromeDriver downloads page: https://chromedriver.chromium.org/downloads. This page lists all available ChromeDriver versions.
2. Match the Major Version
On the downloads page, look for the ChromeDriver release that matches the major version number of your Chrome browser. For example, if your Chrome is 120.x.y.z
, look for ChromeDriver 120.x.y.z
.
3. Download the Appropriate Package
Click on the link for the matching ChromeDriver version. This will take you to a page with download links for different operating systems (e.g., chromedriver_win32.zip
, chromedriver_mac64.zip
, chromedriver_linux64.zip
). Download the package relevant to your operating system.
Step 3: Setting Up ChromeDriver for Selenium
After downloading, you need to extract the ChromeDriver executable and make it accessible to your Selenium scripts.
1. Extract the ChromeDriver Executable
Unzip the downloaded file. You will find an executable file named chromedriver
(or chromedriver.exe
on Windows).
2. Place ChromeDriver in a Known Location
Move the chromedriver
executable to a directory that is either in your system's PATH environment variable or a location easily referenced by your script. A common practice is to place it in your project directory or a dedicated drivers
folder.
3. Configure Selenium to Use ChromeDriver
In your Selenium script, you'll need to specify the path to the ChromeDriver executable. Here's an example in R using RSelenium
:
library(RSelenium)
# Option 1: If chromedriver is in your system PATH
# rD <- rsDriver(browser = "chrome", port = 4444L)
# Option 2: Specify the path to chromedriver executable
# Replace 'path/to/your/chromedriver' with the actual path
chrome_driver_path <- "/usr/local/bin/chromedriver" # Example for macOS/Linux
# chrome_driver_path <- "C:/path/to/your/chromedriver.exe" # Example for Windows
rD <- rsDriver(
browser = "chrome",
port = 4444L,
chromever = "120.0.6099.109", # Specify your exact Chrome version
extraCapabilities = list(
"chromeOptions" = list(
"binary" = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" # Path to Chrome browser binary
)
)
)
remDr <- rD$client
remDr$navigate("http://www.google.com")
print(remDr$getTitle())
remDr$close()
rD$server$stop()
Example R code using RSelenium to initialize ChromeDriver with a specified path.
chromever
argument in rsDriver
is crucial for RSelenium
to download the correct ChromeDriver if it's not already present or if you want to ensure a specific version is used. However, if you manually download and specify the path, ensure the chromever
argument matches your downloaded version.By following these steps, you can effectively manage your Chrome and ChromeDriver versions, ensuring smooth and error-free Selenium automation. Regularly checking for updates to both Chrome and ChromeDriver is a good practice to maintain compatibility and leverage the latest features and security patches.