3

my dears,

can you please help to solve the problem? My browser no longer opens during the run. Thank you very much.

I got the following error since yesterday:

ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790

my code look like this at the beginning:

import pyautogui
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from pynput.keyboard import Key, Controller
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


options = Options()
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)```
fedordima
  • 47
  • 5

1 Answers1

3

selenium 4.10.0 and newer includes the driver manager, so you can do this:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

service = Service()
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
# ...
driver.quit()

If the driver isn't found on your system PATH, Selenium Manager will automatically download it.


If you're wondering why you're now seeing errors for ChromeDriverManager, it's because https://chromedriver.chromium.org/downloads only goes up to version 114 due to driver restructuring by the Chromium Team for the new Chrome-for-Testing.


There's also the SeleniumBase Python selenium framework, which already has a fix for the Chrome 115 issue in the latest version: (After pip install seleniumbase, run the following with python):

from seleniumbase import Driver

driver = Driver(browser="chrome", headless=False)
# ...
driver.quit()
Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
  • I am getting an error service = Service() TypeError: __init__() missing 1 required positional argument: 'executable_path' – Steve Scott Aug 18 '23 at 14:02
  • Make sure you're on the latest version of selenium. In https://github.com/SeleniumHQ/selenium/blob/1104c8f876011fc3fe11eb56d112a10312822866/py/selenium/webdriver/chrome/service.py#L34 - the args have defaults set for `Service()`. – Michael Mintz Aug 18 '23 at 15:32