‘chromedriver’ executable needs to be available in the path

[ad_1]

Are you are learning about “[4 Solution] WebDriverException: Message: ‘chromedriver’ executable needs to be available in the path“? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now

[4 Solution] WebDriverException Message: The message ‘chromedriver’ executable must be in the path

I’m trying to use Chrome Webdriver in my Python application, but I’m getting the following error.

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

How to Solve WebDriverException

Solve WebDriverException: The message: ‘chromedriver’ executable must be present in the path Error. You should use webdriver-manager. This can be accomplished automatically by simply installing this module. This command will first be run: pip install webdriver-manager. Then, use the following code. The second solution is that you may encounter an error while assigning the wrong path to webdriver. Here’s my example browser = webdriver.Chrome(executable_path=’F:Python ScriptWebDriverchromedriver.exe’)

The third solution is to add path string and then use raw string.

Solution 1: Use webdriver manager

Use webdriver-manager This is done by simply installing the module. This command should be run first.

pip install webdriver-manager

This code will be used.

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())

Solution 2: Simply assign the full path to the web driver

This error could occur when you assign the wrong path to webdriver. Here’s my example.

browser = webdriver.Chrome(executable_path="F:Python ScriptWebDriverchromedriver.exe")   

Solution 3: Add path string to raw string

Use raw string instead of path string.

driver = webdriver.Chrome(r"F:Python ScriptWebDriverchromedriver.exe")

Solution 4: Install the driver

This command will be executed if Ubuntu is used.

sudo apt install chromium-chromedriver

This command will work if you are using Debian

sudo apt install chromium-driver

This command will work if you are using macOS

brew cask install chromedriver

Final Words

The above are useful solutions for the question “[4 Solution] WebDriverException: Message: ‘chromedriver’ executable needs to be available in the path?”, if you can’t solve it well. Please leave a message.

[ad_2]

Source link