selenium.common.exceptions.SessionNotCreatedException:此版本的 ChromeDriver 仅支持 Chrome 版本 114。LATEST_RELEASE_115 不存在

egg*_*man 29 python chromium selenium-chromedriver selenium-webdriver

#Once the zip has finished downloading, extract the folder and copy the path of the chromedriver exe file (should be the #first one), add it to your code like this,

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

url = "somewebsite.com"

service_obj = Service("D:\\Users\\eggman\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
driver = webdriver.Chrome(service=service_obj)
driver.get(url)
Run Code Online (Sandbox Code Playgroud)

返回错误:

selenium.common.exceptions.SessionNotCreatedException:此版本的 ChromeDriver 仅支持 Chrome 版本 114。LATEST_RELEASE_115 不存在

我想为了避免这种情况,我可以关闭自动更新吗?

我最初使用了以下代码,效果很好

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
Run Code Online (Sandbox Code Playgroud)

Mic*_*ntz 39

对于 Chrome/chromedriver 116+,解决方案类似于/sf/answers/5371208741/,但现在您需要最低selenium版本的4.11.2. 然后selenium在运行时为您获取正确的驱动程序。

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

service = Service()
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
# ... Automate something here
driver.quit()
Run Code Online (Sandbox Code Playgroud)

有关新的 Chrome-for-Testing 的更多信息,请参阅https://googlechromelabs.github.io/chrome-for-testing/(其中还包括用于测试的 chromedrivers)。

  • 这有效。但在我升级 selenium 之前:“pip install --upgrade selenium” (2认同)

小智 7

请使用以下命令升级 Selenium。它帮助我解决了问题。此版本的 Selenium 将开始识别正确的浏览器版本。(环境:Windows\xc2\xa010PyCharmvenv

\n
pip install -U selenium==4.11.2\n
Run Code Online (Sandbox Code Playgroud)\n

  • 不起作用..``消息:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 114 当前浏览器版本是 120.0.6099.130,带有二进制路径`` (2认同)