Running Selenium WebDriver Python Bindings in Chrome

Running Selenium WebDriver Python Bindings in Chrome

21 May 2024 Stephan Petzl Leave a comment Tech-Help

Many developers encounter issues when attempting to run Selenium WebDriver with Python bindings in Chrome. This guide will provide a clear solution to this common problem, ensuring that you can connect to and control the Chrome browser effectively.

Understanding the Issue

When you try to launch Chrome using Selenium WebDriver without specifying the ChromeDriver path, you might encounter an error stating that the ChromeDriver executable needs to be available in the path. Additionally, specifying the Chromium path might still result in connection issues.

Step-by-Step Solution

Ensuring ChromeDriver is in Your Path

The standalone ChromeDriver binary is necessary for Selenium to communicate with the Chrome browser. Follow these steps to set up ChromeDriver correctly:

  1. Download the ChromeDriver binary from the official website.
  2. Ensure the downloaded ChromeDriver is in your system path or set the environment variable.

Example Code

Here is a Python code example that demonstrates how to specify the path to the ChromeDriver:

import os
from selenium import webdriver

chromedriver = "/path/to/chromedriver"
os.environ[""] = chromedriver
driver = webdriver.Chrome(chromedriver)

Platform-Specific Instructions


For Linux users, you can install the latest version of Chrome and set up ChromeDriver as follows:

  1. Install the latest version of Chrome: sudo apt-get install chromium-browser
  2. Download and unzip the appropriate version of ChromeDriver.
  3. Move the ChromeDriver to the /usr/bin directory: sudo mv chromedriver /usr/bin
  4. Make the ChromeDriver executable: sudo chmod a+x chromedriver

Then, you can run your Selenium script:

from selenium import webdriver

driver = webdriver.Chrome()

Mac OS X

On Mac OS X, you can use Homebrew to install ChromeDriver easily:

brew install chromedriver


For Windows users, follow these steps:

  1. Download the ChromeDriver executable.
  2. Place the ChromeDriver executable in the C:\Python27\Scripts directory or another directory of your choice.

Then, you can run your Selenium script:

from selenium import webdriver

driver = webdriver.Chrome()

Enhance Your Testing with Repeato

For those looking to streamline and enhance their testing process, consider using Repeato. Repeato is a no-code test automation tool for iOS and Android, allowing you to create, run, and maintain automated tests for your apps efficiently. With its intuitive test recorder and scripting interface, Repeato can handle complex use cases and speed up your testing cycle.

Learn more about Repeato and how it can help you with automated testing on our documentation page.

Like this article? there’s more where that came from!