WebDriverException: Unknown Error in Selenium with Older Chrome Versions
When using Selenium with older versions of Google Chrome, users may encounter the error "WebDriverException: unknown error: cannot find Chrome binary." This error occurs when the ChromeDriver cannot locate the Chrome binary in the expected default location.
Solution:
To resolve this issue, explicitly specify the Chrome binary location using the Options.binary_location property. This property accepts the path to the Chrome binary executable.
<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 providing the exact location of the Chrome binary, the ChromeDriver can accurately locate and launch Chrome, resolving the "cannot find Chrome binary" error.
The above is the detailed content of Why Am I Getting \'WebDriverException: Unknown Error\' in Selenium with Older Chrome Versions?. For more information, please follow other related articles on the PHP Chinese website!