[英]How to stop selenium from printing webdriver-manager messages in python?
[英]Selenium problem with the webdriver version installed through webdriver-manager while getting started
我正在为 Selenium 苦苦挣扎,因为驱动程序管理软件部分中的官方入门代码返回了一个错误:
官方代码
# Use Webdriver Manager for Python: https://github.com/SergeyPirogov/webdriver_manager
# Import code:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
# Use the `install()` method to set `executabe_path` in a new `Service` instance:
service = Service(executable_path=ChromeDriverManager().install())
# Pass in the `Service` instance with the `service` keyword:
driver = webdriver.Chrome(service=service)
错误
Current google-chrome version is 96.0.4664
Get LATEST chromedriver version for 96.0.4664 google-chrome
Driver [C:\Users\my_name\.wdm\drivers\chromedriver\win32\96.0.4664.45\chromedriver.exe] found in cache
问题是我已经下载了可用的最新 chromedriver 版本,如下图所示:
下载的chromedriver版本
我的Chrome 版本是 96.0.4664.110 ,我没有在下载驱动程序列表中找到该版本,所以我刚刚下载了最新的 96.0.4664 版本(即 96.0.4664.45 版本),正如错误提示的那样。
这些日志消息...
Current google-chrome version is 96.0.4664
Get LATEST chromedriver version for 96.0.4664 google-chrome
Driver [C:\Users\my_name\.wdm\drivers\chromedriver\win32\96.0.4664.45\chromedriver.exe] found in cache
...不是任何错误,而是操作日志消息。
无论是否下载了可用的最新ChromeDriver版本, webdriver-manager都会根据您系统中安装的google-chrome版本下载匹配的ChromeDriver 。
虽然Chrome 浏览器团队最近推送了一个小更新,当前版本为96.0.4664.110版本,但最新的ChromeDriver v96.0.4664.45已经过测试,似乎与Chrome 浏览器版本 96.0.4664.110完美配合。 所以你是安全的,一切准备就绪。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.