How to Download and Set Up ChromeDriver
Google ChromeDriver is a crucial tool for Selenium WebDriver users who want to automate web testing in Google Chrome. It acts as a bridge between Selenium scripts and the Chrome browser, enabling automation. This guide will walk you through the process of downloading and setting up ChromeDriver.
Step 1: Check Your Chrome Version
Before downloading ChromeDriver, you need to determine which version of Google Chrome is installed on your system. Follow these steps:
- Open Google Chrome.
- Click on the three-dot menu in the top-right corner.
- Select Help > About Google Chrome.
- Note the version number displayed (e.g., 120.0.6099.71).
Step 2: Download the Corresponding ChromeDriver
- Visit the official ChromeDriver download page:
https://sites.google.com/chromium.org/driver/ - Locate the version that matches your Chrome browser.
- Click on the version and select the appropriate file for your operating system:
- Windows:
chromedriver-win64.zip - Mac:
chromedriver-mac-arm64.zip(for M1/M2 Macs) orchromedriver-mac-x64.zip - Linux:
chromedriver-linux64.zip
- Windows:
- Download and extract the ZIP file to a convenient location on your computer.
Step 3: Add ChromeDriver to System Path
To run ChromeDriver from any location, add it to your system’s PATH.
For Windows:
- Move
chromedriver.exeto a desired directory (e.g.,C:\webdriver\chromedriver.exe). - Open System Properties > Advanced > Environment Variables.
- Under System variables, select Path and click Edit.
- Click New and add the ChromeDriver directory path.
- Click OK to save the changes.
For Mac/Linux:
- Open Terminal.
- Move the extracted
chromedriverfile to/usr/local/bin/using:sudo mv chromedriver /usr/local/bin/ chmod +x /usr/local/bin/chromedriver - Verify the installation by running:
chromedriver --version
Step 4: Verify ChromeDriver Installation
After setting up, confirm that ChromeDriver is installed correctly by opening a terminal or command prompt and running:
chromedriver --version
If it displays the correct version number, you have successfully installed ChromeDriver.
Conclusion
ChromeDriver is an essential tool for web automation with Selenium. By following these steps, you can easily download, install, and configure it on your system. Keeping ChromeDriver updated to match your Chrome version ensures smooth automation without compatibility issues.
If you encounter any issues, check for ChromeDriver updates or refer to Selenium’s official documentation for troubleshooting tips.
