Selenium: chromedriver executable needs to be in PATH?

Selenium is a popular web browser automation library used for web scraping. To run, however, Selenium needs special web browser executables called drivers. For example, to run Chrome web browser Selenium needs chromedriver to be installed. Without it a generic exception will be raised:

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.

This can also mean that the chromedriver is installed but Selenium can't find it. To fix this the chromedriver location should be added to the PATH environment variable:

$ export PATH=$PATH:/location/where/chromedriver/is/

Alternatively, we can specify the driver directly in the Selenium initiation code:

from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'your\path\chromedriver.exe')
Question tagged: Selenium, Python

Related Posts

How to Scrape Google Maps

We'll take a look at to find businesses through Google Maps search system and how to scrape their details using either Selenium, Playwright or ScrapFly's javascript rendering feature - all of that in Python.

Web Scraping with Selenium and Python Tutorial + Example Project

Introduction to web scraping dynamic javascript powered websites and web apps using Selenium browser automation library and Python.

How to Scrape Dynamic Websites Using Headless Web Browsers

Introduction to using web automation tools such as Puppeteer, Playwright, Selenium and ScrapFly to render dynamic websites for web scraping