Python Selenium – unknown error: cannot find Chrome binary

Python Selenium – unknown error: cannot find Chrome binary

This error occurs when Chrome webdriver cannot find the Chrome binary on your system.

To solve this error, you can specify the location of the Chrome binary using Options.

For example, to specify the location of the Chrome binary, following these steps.

Step 1 – Get Options

Get the options property of the webdriver. It returns an Options object.

options = webdriver.ChromeOptions()

Step 2 – Set binary location

Set the binary_location property of the Options object. This step makes the location of Chrome browser binary to the webdriver.

options.binary_location = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

If you browser application is in different location, then update the value accordingly.

Step 3 – Initialize driver with the options

Create the webdriver object using the options created in the previous step.

service = ChromeService(executable_path="/usr/local/bin/chromedriver")
driver = webdriver.Chrome(service=service, options=options)

Related Tutorials

Privacy Policy Terms of Use

SitemapContact Us