0

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?

2
  • Should be double ‘\\’ , example c:\\users\\ also use the extension - chromedriver.exe Commented Apr 9, 2020 at 4:44
  • It is now giving this error - 'WebDriverException: Message: unknown error: Failed to create Chrome process.' Commented Apr 9, 2020 at 5:27

2 Answers 2

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

Just need to add .exe

Sign up to request clarification or add additional context in comments.

2 Comments

But it is giving this error message - 'SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape' and doing the one in the comment is also giving another error :(
didn't see the \u at the start.
0

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()) 

3 Comments

It's still showing the same error - 'WebDriverException: Message: unknown error: Failed to create Chrome process.' :(
Double check my code i have updated @AnastasiaTillibiu
I installed chromedriver in a different location so that chromedriver.exe is not stored in another exe file , so now my location looks like 'C:\Users\pushp\AppData\Local\Google\Chrome\Application\chromedriver_win32\chromedriver.exe' and I wrote - driver=webdriver.Chrome(executable_path=r'C:\Users\pushp\AppData\Local\Google\Chrome\Application\chromedriver_win32\chromedriver.exe')

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.