V
V
Vl6562021-12-17 19:49:13
Python
Vl656, 2021-12-17 19:49:13

selenium + python. Does not work with chrome, although both the path to the binary and the chromedriver are indicated, how to fix it?

Trying to use chrome with its engine. Code below:

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
browser = webdriver.Chrome(executable_path="chromedriver.exe", chrome_options=chrome_options)
browser.get("https://www.google.com/")

And the actual error:
Traceback (most recent call last):
  File "D:\Vova\checker\main.py", line 8, in <module>
    browser = webdriver.Chrome(executable_path="chromedriver.exe", chrome_options=chrome_options)
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
    self.start_session(capabilities, browser_profile)
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
    self.error_handler.check_response(response)
  File "D:\Vova\checker\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question