0

I am using a mac and have python 3 and selenuim 4.10 installed. I cannot work out what I am doing wrong . It was my understanding that from v4.6.0 or higher, you don't have to use a third party library such as WebDriverManager

Below is the python code

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("myUrl")

and this is the error mnessage

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

Any suggestions?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Well, did you install Chrome on your machine? – OneCricketeer Aug 05 '23 at 06:28
  • You will need a Chrome browser. Additionally you'll need to download a compatible chromedriver. When you've done that take a look at the selenium documentation to see how you should use the selenium.webdriver.chrome.service.Service class – DarkKnight Aug 05 '23 at 09:55

2 Answers2

0

The error message unknown error: cannot find Chrome binary indicates that the Chrome binary (executable) is not found in the system's PATH environment variable. When you create a webdriver.Chrome() instance, Selenium tries to locate the Chrome binary to run the ChromeDriver. Since it cannot find the binary, the error is raised.

That means that probably you don't have installed Chrome on you Mac, or reference to it doesn't exist in PATH.

Documentation

Yaroslavm
  • 1,762
  • 2
  • 7
  • 15
0

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

...implies that the ChromeDriver binary was unable to find the binary while inititiating a session.


Details

This error can be observed in a couple of cases as follows:

  • Possibly you don't have Google Chrome installed in your system. In that case you have to install Google Chrome as a mandatory measure.

  • Google Chrome is installed in a non-standard location. In that case you have to pass the absolute path of the Google Chrome binary through the binary_location attribute as follows:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    options = Options()
    options.binary_location = "//customized/location/of/chrome"
    driver = webdriver.Chrome(options=options)
    driver.get("myUrl")
    

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352