WebDriverException: Unknown Error: Cannot Find Chrome Binary with Selenium in Python for Older Google Chrome Versions
When using Selenium with older versions of Google Chrome, you may encounter the following error:
WebDriverException: unknown error: cannot find Chrome binary
This error suggests that ChromeDriver is unable to locate the Chrome binary in its default location.
To resolve this issue:
OS | Default Chrome Location |
---|---|
Linux | /usr/bin/google-chrome1 |
Mac | /Applications/Google Chrome.app/Contents/MacOS/Google Chrome |
Windows XP | %HOMEPATH%Local SettingsApplication DataGoogleChromeApplicationchrome.exe |
Windows Vista and newer | C:Users%USERNAME%AppDataLocalGoogleChromeApplicationchrome.exe |
<code class="python">from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.binary_location = "C:\Program Files\Chrome\chrome64_55.0.2883.75\chrome.exe" driver = webdriver.Chrome('chromedriver.exe', chrome_options=options)</code>
By following these steps, you should be able to resolve the "cannot find Chrome binary" error and successfully launch your WebDriver instance using the specified Chrome version.
The above is the detailed content of Why Can\'t I Find Chrome Binary in Selenium with Older Chrome Versions?. For more information, please follow other related articles on the PHP Chinese website!