Tutorial Example

Fix Selenium ‘chromedriver’ executable needs to be in PATH – Python Tutorial

When we are using selenium in python, we may find ‘chromedriver’ executable needs to be in PATH error. In this tutorial, we will introduce how to fix this problem.

Here is an example:

from selenium import webdriver

driver = webdriver.Chrome()

Run this code, you will get error:

How to fix this path error?

In order to fix this problem, we should tell the path of chromedriver.exe for webdriver.

Here is the solution.

driver = webdriver.Chrome(executable_path=r"E:\Program Files\chromedriver.exe")

E:\Program Files\chromedriver.exe is the path of chromedriver.exe, then you will find this path error is fixed.