0

I used to download of the chrome webdriver by this default code:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options

#Configurations
options = Options()
options.add_argument('window-size=1280x720')

#Default Code
servico = Service(ChromeDriverManager().install())
navegador = webdriver.Chrome(service=servico, options=options)

But now it is occurring a error and I don't know how to resolve this, I've already tried to find some solutions on youtube videos and until in the ChatGPT. Take a look in the response of the terminal:

Traceback (most recent call last):
  File "c:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\bot_teste-senha.py", line 15, in <module>
    servico = Service(ChromeDriverManager().install())
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\chrome.py", line 39, in install
    driver_path = self._get_driver_path(self.driver)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\core\manager.py", line 30, in _get_driver_path      
    file = self._download_manager.download_file(driver.get_driver_download_url())
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\drivers\chrome.py", line 40, in get_driver_download_url
    driver_version_to_download = self.get_driver_version_to_download()
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\core\driver.py", line 51, in get_driver_version_to_download
    self._driver_to_download_version = self._version if self._version not in (None, "latest") else self.get_latest_release_version()
                                                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\drivers\chrome.py", line 62, in get_latest_release_version
    resp = self._http_client.get(url=latest_release_url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\core\http.py", line 37, in get
    self.validate_response(resp)
  File "C:\Users\igorc\Desktop\CodesProg\geral-codes\prog-python\.venv\Lib\site-packages\webdriver_manager\core\http.py", line 16, in validate_response        
    raise ValueError(f"There is no such driver by url {resp.url}")
ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_116.0.5845

Could someone help me what I have to do to solve it? I'm using the last version of the Chrome (Version 116.0.5845.97 (64bits))

Shawn
  • 4,064
  • 2
  • 11
  • 23
  • Does [this](https://stackoverflow.com/questions/76724939/there-is-no-such-driver-by-url-https-chromedriver-storage-googleapis-com-lates) answer your question? – Suraj Shourie Aug 22 '23 at 03:24

2 Answers2

0

Issue: The root cause is the issue with WDM to handle/download chromedriver.exe for latest chrome version 116

Solution:

Assuming you are using latest version of selenium - v4.11.2, you can try the 2 options listed below:

  • You don't need WebDriverManager anymore as selenium has an in-built tool similar to WDM known as SeleniumManager which will do what WDM used to do. So you can remove/comment-out the WDM related code as below:
# servico = Service(ChromeDriverManager().install())
navegador = webdriver.Chrome(options=options)
  • For any specific reason if you want to use WebDriverManager, then upgrade the WDM version to the latest one which is 5.4.1. This should resolve the issue.
Shawn
  • 4,064
  • 2
  • 11
  • 23
0

Please use this script for download chromedriver

sudo apt install unzip && a=$(uname -m) && rm -r /tmp/chromedriver/
mkdir /tmp/chromedriver/ && wget -O /tmp/chromedriver/LATEST_RELEASE http://chromedriver.storage.googleapis.com/LATEST_RELEASE && if [ $a == i686 ]; then b=32; elif [ $a == x86_64 ]; then b=64; fi && latest=$(cat /tmp/chromedriver/LATEST_RELEASE) && wget -O /tmp/chromedriver/chromedriver.zip 'http://chromedriver.storage.googleapis.com/'$latest'/chromedriver_linux'$b'.zip' && sudo unzip /tmp/chromedriver/chromedriver.zip chromedriver -d /usr/local/bin/