Subha Nawer Pushpita
Subha Nawer Pushpita

Reputation: 109

Chromedriver is not being found: executable needs to be in PATH

I have a windows64 bit machine and I downloaded the chromedriver on the exact location it is supposed to be and my file path is this:

'C:\Users\username\AppData\Local\Google\Chrome\Application\chrome.exe\chromedriver'

Then I wrote this code:

import selenium 
from selenium import webdriver
driver=webdriver.Chrome('C:\Users\pushp\AppData\Local\Google\Chrome\Application\chrome.exe\chromedriver')

However, I am getting a file not found error and also this message -

'Message: 'chromedriver' executable needs to be in PATH.'

How do I fix this?

Upvotes: 0

Views: 2249

Answers (2)

0m3r
0m3r

Reputation: 12497

Set it like the following

import selenium 
from selenium import webdriver
webdriver.Chrome(executable_path=r"C:\Users\pushp\AppData\Local\Google\Chrome\Application\chromedriver.exe")

Or


webdriver.Chrome(executable_path="C:\\Users\\pushp\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe")

You can also install pip install webdriver-manager then run the following code which will install the correct webdriver for you

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

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

Upvotes: 0

Arundeep Chohan
Arundeep Chohan

Reputation: 9969

  driver =webdriver.Chrome(r'C:\Users\pushp\AppData\Local\Google\Chrome\Application\chrome.exe\chromedriver.exe')

Just need to add .exe

Upvotes: 1

Related Questions