Vijay Ramesh
Vijay Ramesh

Reputation: 210

WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. - selenium

Before you let me know that this is a duplicate, the issue I am facing is that I am running my python code using a jupyter-notebook via an Ubuntu subsystem on Windows.

I have made sure that the path to the folder on Windows where chromedriver is located is correct. However, I am still getting the same error. Further, I am unable to see where my files from the Ubuntu subsystem are (ie, I can't find a folder on Windows with those files).

Anyway in which I can correct this? such as editing the ~/.bashrc file on Ubuntu?

browser = webdriver.Chrome("C:/Users/vr235/Downloads/chromedriver/chromedriver.exe")

Error:

WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

EDIT:

While a solution was pointed by user DebanjanB and marked as duplicate, I tried the user's suggestion but got the same error.

from selenium.webdriver.chrome.options import Options 

chrome_options = Options()  
chrome_options.add_argument("--headless")  
browser = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\Users\vr235\Downloads\chromedriver\chromedriver.exe')  
browser.get("https://www.sciencedirect.com/") 

Error:

WebDriverException: Message: 'C:\Users\vr235\Downloads\chromedriver\chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Upvotes: 1

Views: 2626

Answers (1)

Vijay Ramesh
Vijay Ramesh

Reputation: 210

In case one is using a WSL, one can identify the path where the Chromedriver is present by viewing the mnt folder on WSL.

For instance: My chromedriver path was in the Downloads folder in C:/ drive

Path : /mnt/c/vr235/Users/Downloads/chromedriver.exe

Once you add the same, the above lines of code work perfectly.

Upvotes: 2

Related Questions