我有一个错误:
E selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 102
E Current browser version is 109.0.5414.120 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
我已经使用代码来获取最新版本的 webdriver-
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--allow-running-insecure-content")
options.add_argument("--ignore-certificate-errors")
options.set_capability("acceptInsecureCerts", True)
preferences = {"profile.default_content_settings.popups": 0,
"download.default_directory": r""+Constants.path+"",
# IMPORTANT - ENDING SLASH V IMPORTANT
"directory_upgrade": True}
options.add_experimental_option("prefs", preferences)
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), options=options)
使用相同的代码,我可以在本地计算机(即笔记本电脑)上运行此代码,但此代码无法在我的虚拟机上运行。
两台机器上的 chrome 版本相同,即 - 109.0.5414.120。
请指导。
你的问题如下:这个ChromeDriverManager().install()
将获得最新的 chromedriver 版本 - 就我今天而言,它是 115.0.5790 - at
https://chromedriver.storage.googleapis.com/ https://chromedriver.storage.googleapis.com/
but on their site
更新:看起来更准确,你可以查看ChromeDriver 仅支持 Chrome 版本 114 当前浏览器版本为 116.0.5845.111 - (Selenium 版本 - 3.141.59) https://stackoverflow.com/questions/76970623/chromedriver-only-supports-chrome-version-114-current-browser-version-is-116-0-5
这不是代码错误,而是库错误之一或由于 chrome 的更改
-> 最新的 chromedriver 版本尚未准备好安装
正如@kaliiiiiiiii 所说,解决方案是,driver = webdriver.Chrome(executable_path=ChromeDriverManager(version="114.0.5735.16").install(), options=options)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)