Sometimes, we want to fix WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome.
In this article, we’ll look at how to fix WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome.
How to fix WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome?
To fix WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome, we set the path of the Chrome binary.
For instance, we write
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(chrome_options = options, executable_path=r'C:pathtochromedriver.exe')
driver.get('http://example.com/')
driver.quit()
to set create an Options object.
Then we set options.binary_location to the path of the Chrome binary.
And then we set the executable_path to the path of the Chrome driver.
Then we call get to open a page at the URL and call quit to exit.
Conclusion
To fix WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome, we set the path of the Chrome binary.