[Properly Fixed] Webdriverexception: Message: ‘chromedriver’ Executable Needs To Be Available In The Path

Finding a workable solution to the WebDriverException: Message: ‘chromedriver’ executable needs to be available in the path error can be challenging. This article provides four potential solutions that have been successful for other users. 

Each of the solutions is accompanied by a description of the steps necessary to implement it. So keep reading to discover now!

When Did “Webdriverexception: Message: ‘chromedriver’ Executable Needs To Be Available In The Path” Error Occur?

If you’re using a WebDriver to control Chrome, and your system can’t find the “chromedriver” executable, you’ll see an error like this: 

WebDriverException: Message: 'chromedriver' executable needs to be available in the path. Please look at     http://docs.seleniumhq.org/download/#thirdPartyDrivers and read up at http://code.google.com/p/selenium/wiki/ChromeDriver

This error can occur if:

1. The chromedriver executable isn’t in your system PATH environment variable. 

2. Your Python application isn’t running from the same directory as the chromedriver executable. 

3. Your Python application tries to run chromedriver from a different directory than where you installed it.

4 Wonderful Solutions For This Error

Solution 1

Finding and downloading the correct WebDriver binary for your operating system and browser can be a time-consuming and challenging process. It can even be impossible in some cases if you don’t have access to the right tools or knowledge.

But there is a solution: webdriver-manager. This open-source tool takes care of all the heavy lifting for you, automatically locating and downloading the latest version of WebDriver for your system and browser. 

You can install it with pip:

pip install webdriver-manager

Then, you need to run this command: 

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())

Solution 2

To solve the WebDriverException: Message: ‘chromedriver’ executable must be available in the path. You can simply assign a full path for the web driver. You can do this by adding the following code: 

browser = webdriver.Chrome(executable_path='F:\Python Script\WebDriver\chromedriver.exe)  

Solution 3

Adding a path string is the best way to ensure that your code will run properly on different machines. Simply add the path to the folder that contains your script, and your code will run without any problems.

Here is the command:

driver = webdriver.Chrome(r"F:\Python Script\WebDriver\chromedriver.exe")

You should also use a raw string to prevent potential errors when working with sensitive data. A raw string is a string that is not interpreted by the interpreter, which means that it will not be affected by changes in the environment.

Solution 4

If you want to use the Chrome browser with Selenium on Ubuntu, Debian, or macOS, you first need to install the Chrome driver. Here are step-by-step instructions for how to do that: 

First of all, you have to open a terminal window. After that, you can type the following command and press Enter.

Ubuntu: 

Run this command:

sudo apt install chromium-chromedriver

Debian: 

Run this command:

sudo apt install chromium-driver

macOS: 

Run this command:

brew cask install chromedriver

Conclusion

In conclusion, the WebDriverException: Message: ‘chromedriver’ executable needs to be available in the path error can be solved by ensuring that the chromedriver executable is in the system path. We hope you can solve this issue successfully after reading this post. Thanks for reading!


Related articles

Scroll to Top