英文:
selenium webdriver chrome 115 stopped working
问题
我在Windows上安装了Chrome 115.0.5790.99,并使用Selenium 4.10.0。在我的Python代码中,我调用了service = Service(ChromeDriverManager().install())
,但出现了错误ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790.
我使用ChromeDriverManager().install()
来确保使用最新稳定版本的WebDriver。如何解决这个问题?
我的简单代码如下:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
# 安装Webdriver
service = Service(ChromeDriverManager().install())
# 创建驱动程序实例
driver = webdriver.Chrome(service=service)
# 获取网页
driver.get('https://www.crawler-test.com')
time.sleep(5)
driver.quit()
错误输出如下:
Traceback (most recent call last):
File "C:\Users\Administrator\Documents\...\test.py", line 7, in <module>
service = Service(ChromeDriverManager().install())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\webdriver_manager\chrome.py", line 39, in install
driver_path = self._get_driver_path(self.driver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\webdriver_manager\core\http.py", line 37, in get
self.validate_response(resp)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\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_115.0.5790
我尝试了以下方法,但都没有成功:
- 禁用Chrome自动更新,但Chrome仍然成功更新自己(https://www.minitool.com/news/disable-automatic-chrome-updates.html 和 https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac );
- 安装Chrome 114和版本114的WebDriver,然后它可以正常工作,直到Chrome自动更新;
- 遵循说明 https://chromedriver.chromium.org/downloads/version-selection 但在生成URL和运行链接 https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790 时出现错误 No such object: chromedriver/LATEST_RELEASE_115.0.5790。
有没有建议如何解决这个问题,直到Chrome 115的WebDriver最终在这里发布 https://chromedriver.chromium.org/downloads?
英文:
I have Chrome 115.0.5790.99 installed on Windows and I use Selenium 4.10.0. In my python code I call service = Service(ChromeDriverManager().install()) and it returns the error ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790. I use ChromeDriverManager().install() in order to ensure the use of last stable version of webdriver. How to solve the issue?
My simple code:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
# Install Webdriver
service = Service(ChromeDriverManager().install())
# Create Driver Instance
driver = webdriver.Chrome(service=service)
# Get Web Page
driver.get('https://www.crawler-test.com')
time.sleep(5)
driver.quit()
Error output:
Traceback (most recent call last):
File "C:\Users\Administrator\Documents\...\test.py", line 7, in <module>
service = Service(ChromeDriverManager().install())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\webdriver_manager\chrome.py", line 39, in install
driver_path = self._get_driver_path(self.driver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\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\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\webdriver_manager\core\http.py", line 37, in get
self.validate_response(resp)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\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_115.0.5790
I tried the following but no success:
- to disable Chrome auto-update but Chrome manage to update itself anyway (https://www.minitool.com/news/disable-automatic-chrome-updates.html and https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac );
- to install Chrome 114 and webdriver for ver 114, than it works till Chrome get updated automatically;
- to follow instructions https://chromedriver.chromium.org/downloads/version-selection but when generating URL and running link https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790 I get error No such object: chromedriver/LATEST_RELEASE_115.0.5790
Any suggestion how to solve the issue till webdriver for Chrome 115 will be finally released here https://chromedriver.chromium.org/downloads
答案1
得分: 30
Selenium Manager现在完全包含在selenium
4.10.0
中,所以这是您所需要的全部内容:
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()
如果在您的系统路径上找不到驱动程序,Selenium Manager将自动下载它。
如果您想知道为什么现在看到了ChromeDriverManager
的这个错误,那是因为https://chromedriver.chromium.org/downloads只支持到版本114,这是由于Chromium团队为新的Chrome-for-Testing进行了驱动程序重构所致。
英文:
Selenium Manager is now fully included with selenium
4.10.0
, so this is all you need:
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 this error 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.
答案2
得分: 10
这对我有用:
service = Service(ChromeDriverManager(version="114.0.5735.90").install())
英文:
This worked for me:
service = Service(ChromeDriverManager(version="114.0.5735.90").install())
答案3
得分: 7
不确定您正在使用哪个版本的Selenium,如果您使用的是最新版本,比如Selenium v4.6.0
或更高版本,您就不必使用第三方库如WebDriverManager
来处理浏览器驱动程序。您的代码可以简化如下:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.crawler-test.com")
print(driver.title)
结果:
Crawler Test Site
进程以退出代码0完成
更新: ChromeWebDriverManager
与确保WebDriver
的稳定版本无关,它用于确保根据您系统中的浏览器版本使用正确版本的驱动程序二进制文件(chromedriver.exe
)。话虽如此,现在使用selenium v4.6.0
或更高版本,selenium的内置工具SeleniumManager
将为我们处理浏览器驱动程序。换句话说,SeleniumManager
将执行WebDriverManager
曾经做过的工作。
参考链接: 介绍Selenium Manager
英文:
Not sure which version of selenium you are using, if you are on latest version say selenium v4.6.0
or higher, you don't have to use third party library such as WebDriverManager
to handle browser drivers. Your code can be simplified as below:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.crawler-test.com")
print(driver.title)
Result:
Crawler Test Site
Process finished with exit code 0
Update: ChromeWebDriverManager
has nothing to do with ensuring stable version of WebDriver
, it is used to ensure the correct version of driver binaries (chormedriver.exe
) are used as per the browser version in your system. Having said that, now with selenium v4.6.0
or above, selenium's in-built tool SeleniumManager
will handle the browser drivers for us. In other words, SeleniumManager
will do what WebDriverManager
used to do.
Reference: Introducing Selenium Manager
答案4
得分: 6
service = Service(ChromeDriverManager(version="114.0.5735.90").install())
英文:
Try this one:
service = Service(ChromeDriverManager(version="114.0.5735.90").install())
答案5
得分: 5
我已更新webdriver-manager
,之后没有遇到任何问题。
pip install --upgrade webdriver-manager
英文:
I've updated webdriver-manager
and didn't face any issues afterwards.
pip install --upgrade webdriver-manager
答案6
得分: 2
直到稳定版本的Webdriver 115发布之前,解决方法是使用测试Webdriver并相应地测试Chrome。步骤如下:
- 卸载系统中当前安装的Webdriver和Chrome;
- 在此处查找稳定版本的Webdriver和Chrome:https://googlechromelabs.github.io/chrome-for-testing/
- 搜索二进制Chrome和Chromedriver(Webdriver和Chrome的版本应该相同!);
- 安装Chrome(实际上只需解压缩并将其放入某个文件夹,例如:c:\chrome-test-ver);
- 将文件夹c:\chrome-test-ver添加到PATH环境变量中);
- 安装webdriver.exe(只需解压缩并复制到Python文件夹,例如:C:\Users\Administrator\AppData\Local\Programs\Python\Python311);
- 运行带有Selenium的Python脚本,应该可以正常工作。
英文:
Until stable webdriver ver 115 is released, the solution is to use test webdriver and test Chrome accordingly. The steps are:
- uninstal current installed webdriver and Chrome from the system;
- find the stable version of webdriver and Chrome here
https://googlechromelabs.github.io/chrome-for-testing/ - search for binary chrome and chromedriver (version of the webdriver
and Chrome should be the same!); - install Chrome (actually you just unzip it and put it to some folder,
ie: c:\chrome-test-ver); - set folder c:\chrome-test-ver to the PATH envirounment variable);
- install webdriver.exe (just unzip it and copy to the Python folder,
ie: C:\Users\Administrator\AppData\Local\Programs\Python\Python311); - run your python script with selenium and it should work.
答案7
得分: 2
以下是翻译好的部分:
对于那些在2023年7月26日之后使用Selenium 4.8.0进行测试应用程序遇到问题的人,实际上在2023年7月26日,Chrome自动更新到了版本115.0.5790.110,但其Web驱动程序尚未上传到任何地方,最可靠的网站https://googlechromelabs.github.io/chrome-for-testing/#stable和https://chromedriver.chromium.org/downloads也都没有Web驱动程序可用。
好消息是,我找到了解决方法,我的代码正常工作,我的测试工具也像以前一样正常工作。以下是代码。在运行这些代码之前,需要执行以下步骤:
步骤 - 01. pip uninstall selenium
步骤 - 02. pip install selenium==4.10.0
步骤 - 03. pip show selenium(确保已安装selenium版本4.10.0)
步骤 - 04. pip install webdriver_manager
Python / selenium 4.10.0中的代码
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),
options=options)
url = 'https://www.google.com/'
driver.get(url)
driver.maximize_window()
sleep(10)
如果有人想停止Chrome的自动更新,请随时向我询问,我也可以为您提供解决方法。
英文:
Solution for those, who are facing problems after 26-07-2023 in the testing application using selenium 4.8.0, actually on 26-07-2023 chrome automatically updated to Version 115.0.5790.110 and its web driver is not uploaded yet anywhere, the most reliable site https://googlechromelabs.github.io/chrome-for-testing/#stable and https://chromedriver.chromium.org/downloads, but nowhere web driver available.
Good News is that I found the solution and my codes are working perfectly my testing tools are also working fine like the old ones. here are the codes for you. Before going to run these codes following steps need to be done:
Step - 01. pip uninstall selenium
Step - 02. pip install selenium==4.10.0
Step - 03. pip show selenium (Make sure the selenium version 4.10.0) is installed.
Step - 04. pip install webdriver_manager
##Codes in Python/selenium 4.10.0
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),
options=options)
url = 'https://www.google.com/'
driver.get(url)
driver.maximize_window()
sleep(10)
if anyone wants to stop the automatic update of Chrome, please feel free to ask me, I can also give you the solution for the same.
答案8
得分: 2
import urllib.request
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
try:
service = Service(ChromeDriverManager().install())
except ValueError:
latest_chromedriver_version_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
latest_chromedriver_version = urllib.request.urlopen(latest_chromedriver_version_url).read().decode('utf-8')
service = Service(ChromeDriverManager(version=latest_chromedriver_version).install())
options = Options()
options.add_argument('--headless') #optional.
driver = webdriver.Chrome(service=service, options=options)
driver.get(url)
英文:
To avoid the need to manually update to the latest version you can try:
import urllib.request
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
try:
service = Service(ChromeDriverManager().install())
except ValueError:
latest_chromedriver_version_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
latest_chromedriver_version = urllib.request.urlopen(latest_chromedriver_version_url).read().decode('utf-8')
service = Service(ChromeDriverManager(version=latest_chromedriver_version).install())
options = Options()
options.add_argument('--headless') #optional.
driver = webdriver.Chrome(service=service, options=options)
driver.get(url)
答案9
得分: 1
从Chrome v115版本开始,您需要安装“Google Chrome for Testing”(https://developer.chrome.com/blog/chrome-for-testing)才能在本地运行Chrome上的任何自动化测试。
英文:
From Chrome v115 you will need to install "Google Chrome for Testing" https://developer.chrome.com/blog/chrome-for-testing to run any automated tests locally on Chrome.
答案10
得分: 1
错误与webdriver-manager版本相关。
请使用以下命令将webdriver-manager更新到最新版本:
pip install --upgrade webdriver-manager
该问题已在版本3.8.6(2023年4月13日)中得到修复。
修复了Chrome/Edge的版本下载逻辑:
- 如果版本为“latest”,则下载Chrome/Chromium的LATEST_RELEASE和Edge的LATEST_STABLE;
- 如果版本为x.x.x,则下载x.x.x;
- 如果版本为None,则尝试确定已安装的浏览器版本,如果失败,则下载类似于“latest”的版本 - LATEST_RELEASE。
英文:
The bug is linked to webdriver-manager version.
Please update webdriver-manager to lastest version using:
pip install --upgrade webdriver-manager
It got fixed in version 3.8.6 (13th April 2023)
> Fixed version download logic for Chrome/Edge:
>
>- if version="latest" - downloads LATEST_RELEASE for Chrome/Chromiums and LATEST_STABLE for Edge;
>- if version=x.x.x - downloads x.x.x;
>- if version is None - tries to determine installed browser version, and if fail - downloads like "latest" - LATEST_RELEASE.
答案11
得分: 1
这个问题是因为从版本115开始,ChromeDriver的发布流程与Chrome的流程集成在一起,即它将在以下位置提供:
Chrome测试版(CfT)可用性仪表板。
如果您需要方便的JSON:CfT JSON端点
您可以编写自己的方法来从上面提到的链接下载JSON,并下载适用于您的Chrome版本的驱动程序。
参考:ChromeDriver - 适用于版本115及更高版本
英文:
This issue arose because starting from version 115, ChromeDriver release process is integrated with that of Chrome, i.e, it will be available at:
the Chrome for Testing (CfT) availability dashboard.
If you want a convenient json: CfT JSON endpoints
You could write your method to download the json from the link mentioned above and download the driver for your version of Chrome.
Reference: ChromeDriver - For versions 115 and newer
答案12
得分: 0
解决方案:
在命令提示符或pycharm终端中输入以下内容:
pip卸载webdriver_manager
点击Y(是)
然后输入pip安装webdriver_manager
英文:
Solution :
In the command prompt or on pycharm terminal: type
pip uninstall webdriver_manager
Click on Y (yes)
Then type pip install webdriver_manager
答案13
得分: 0
我之前使用的是Selenium 3.11,升级到v4.11.2解决了问题。
对于Windows,运行以下命令以升级版本。
pip install selenium --upgrade
我还在我的Selenium脚本中添加了以下语句,以了解系统正在运行的版本 -
browser_version = driver.capabilities['browserVersion']
driver_version = driver.capabilities['chrome']['chromedriverVersion'].split(' ')[0]
print ("Selenium版本:", selenium.__version__)
print("浏览器版本", browser_version)
print("驱动程序版本", driver_version)
英文:
I was running Selenium 3.11 and upgrading it to v4.11.2 resolved the issues.
For Windows, run this command to upgrade the version.
pip install selenium --upgrade
I also added these statements to my Selenium script to know which versions the system is operating on -
browser_version = driver.capabilities['browserVersion']
driver_version = driver.capabilities['chrome']['chromedriverVersion'].split(' ')[0]
print ("Selenium version:", selenium.__version__)
print("browser version", browser_version)
print("driver version", driver_version)
答案14
得分: 0
IDevFS提供的解决方案在版本115之前用于自动更新非常出色:
import urllib.request
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
try:
service = Service(ChromeDriverManager().install())
except ValueError:
latest_chromedriver_version_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
latest_chromedriver_version = urllib.request.urlopen(latest_chromedriver_version_url).read().decode('utf-8')
service = Service(ChromeDriverManager(version=latest_chromedriver_version).install())
options = Options()
options.add_argument('--headless') #可选
driver = webdriver.Chrome(service=service, options=options)
driver.get(url)
然而,至今尚未找到一种使用cf JSON终端点进行自动更新的方法。有人可以在这方面提供帮助吗?
英文:
The solution given by IDevFS was amazing for automatic updates before version 115:
import urllib.request
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
try:
service = Service(ChromeDriverManager().install())
except ValueError:
latest_chromedriver_version_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
latest_chromedriver_version = urllib.request.urlopen(latest_chromedriver_version_url).read().decode('utf-8')
service = Service(ChromeDriverManager(version=latest_chromedriver_version).install())
options = Options()
options.add_argument('--headless') #optional.
driver = webdriver.Chrome(service=service, options=options)
driver.get(url)
However, haven't find yet a way to make automatic updates with the cf JSON Endpoints. Can anyone help in this regard?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论