Why Am I Getting \'WebDriverException: Unknown Error\' in Selenium with Older Chrome Versions?

Barbara Streisand
Release: 2024-11-02 09:33:03
Original
889 people have browsed it

Why Am I Getting

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!