How To Fix “message: ‘chromedriver’ executable needs to be in PATH”?
Are you having problems with the issue “message: ‘chromedriver’ executable needs to be in PATH“? How to fix it? 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
How did “message: ‘chromedriver’ executable needs to be in PATH” occur?
message: ‘chromedriver’ executable needs to be in PATH
When you work with Python, you may get the issue message: ‘chromedriver’ executable needs to be in PATH. Don’t worry, we are here to provide you solutions in order to resolve your problem.
How to fix “message: ‘chromedriver’ executable needs to be in PATH”?
To solve the message, ‘chromedriver” executable must be in PATH. Second solution is to use webdriver-manager to automatically manage chromedriver. Just install this package: pip install webdriver-manager and third solution is Just add path string, begin with the letter r
before the string, for raw string. This worked for me.
Solution 1: Specify the full path to chromedriver.exe
You must specify the chromedriver.exe path. Here is an example code.
from selenium import webdriver
chrome_driver = webdriver.Chrome('C:\path\to\chromedriver.exe')
Your error must now be fixed
Solution 2: Use webdriver manager
Simply use webdriver-manager to manage chromedriver automatically Simply install this package.
pip install webdriver-manager
This is the example code.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
Solution 3: use raw string
For raw string, just add path string. This worked for me.
driver = webdriver.Chrome(r"C:/Users/michael/Downloads/chromedriver_win32/chromedriver.exe")
Final words
The above are useful solutions that can help you fix “message: ‘chromedriver’ executable needs to be in PATH” problem, if you can’t solve it well. Please leave a message.