Solving Message: ‘chromedriver’ executable needs to be in PATH

Message: ‘chromedriver’ executable needs to be in PATH is an error which occurs when the .exe file is not in the correct path.

In this article I am going to help you solve this error and understand the root of the problem, also I am presenting other possible solutions that may work if the main solution does not work for you.

Describing Message: ‘chromedriver’ executable needs to be in PATH

The error happens when WebDriver thinks that the path to the chromedriver is invalid.

The error is easy to replicate, any Selenium script should start with

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner

We have imported webdriver in the first line, now we are setting up the desired browser

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner-1

Then we use the browser to open the page we want to open.

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner-2

The resulting error is the following

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner-3

Bellow you can find the solution which worked for me plus other popular possible solutions among developers who already faced this error.

Solution 1 : put chromedriver.exe in the root of the directory

The easiest solution to the issue is to navigate to the directory where the chromedriver executable file lives, then take chromedriver.exe and move it to the directory where your selenium script is located.

Remember to put chromedriver.exe in the root of the same directory of the .py script you are working on.

Solution 2 : Using the Raw (r)

This solution is very popular, when I tried it, my error was solved instantly.

We will just edit the path where chrome driver resides, so this is the directory path before the change

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner-4

We will use only back slashes and we will use the character r at the beginning of the path as you can see bellow.

Solving Message ‘chromedriver’ executable needs to be in PATH-problem-banner-5

This should be enough to get rid of the error for good.

Summing-up

This is the end of our article, the error Message: ‘chromedriver’ executable needs to be in PATH could be confusing but with a little bit of investigating the error could be solved easily, thanks for reading this article.

To support us consider donating to our Kofi account using the big red button above. Keep coding, keep learning and cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/