0

I'm trying to automate a process using selenium. When I run the code it gives me the error bellow.

WebDriverException: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.22000 x86_64)

I have downloaded the new driver and passed the variable in system variables under path. Can anyone please help me figure this out. I'm a student just starting my tech career.

2 Answers 2

2

This question has been asked many times before in similar disguises and the answers have usually advised to match versions. However, i have often struggled to match versions (for various reasons) and this is rather cumbersome when the versions keep changing.

For this reason, I use the ChromeDriverManager() which installs the correct version at each time.

You need to install webdriver-manager:

pip install webdriver-manager

And this is the working code

# selenium 4
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By


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

You can find the docs here: https://pypi.org/project/webdriver-manager/

This module recognises and has solved a problem for us all:

It’s boring!!! Moreover every time the new version of driver released, you should go and repeat all steps again and again.

I hope it helps.

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

7 Comments

If your first line is true, you should vote to close as a duplicate and not answer the question. How to Answer
@Rob, noted. I edited the comment because i always find myself comming back to this and having to search. (I will certainly close duplicates going forwards, so thanks for pointing this out).
Again, if it's a duplicate, it should be closed. So why not close it now?
because the answers have always pointed to matching the versions (which i have used, but struggled with) and i prefer this method. So i would actually like it to be documented (as i will probably refer back to it myself)...
I appreciate your answer and found it useful. I wasn't able to resolve my issues using the other answers, but had success once I installed webdriver-manager.
|
0

This error message...

WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.39.562718 

...implies that the ChromeDriver was unable to locate the executable.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.39
  • As per this discussion chromedriver=2.39 :

Supports Chrome v66-68

Supports Chrome version 99

So there is a clear mismatch between chromedriver=2.39 and the chrome=99.0


Solution

Ensure that:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.