gpt4 book ai didi

python - selenium.common.exceptions.SessionNotCreatedException : Message: session not created: This version of ChromeDriver only supports Chrome version 114

转载 作者:行者123 更新时间:2023-12-03 07:52:08 30 4
gpt4 key购买 nike

我收到以下错误:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114Current browser version is 116.0.5845.97 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

有人可以帮助我吗?我在其他帖子中看到了一些建议,但在这里不起作用。我知道 Selenium v​​4.6 更新

我的代码:

from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By




class ChromeAuto:
def __init__(self):
self.options = webdriver.ChromeOptions()
self.options.add_experimental_option('excludeSwitches', ['enable-logging'])
self.service = Service()
self.chrome = webdriver.Chrome(service=self.service, options=self.options)
self.chrome.implicitly_wait(20)

最佳答案

对于 Chrome 116+,您至少需要 selenium 4.11.2,Selenium Manager 才能下载 chromedriver 116+ 来自 https://googlechromelabs.github.io/chrome-for-testing/

然后您将能够运行基本的 Selenium 脚本,如下所示:

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

service = Service()
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])

driver = webdriver.Chrome(service=service, options=options)
# Add your code here
driver.quit()

关于python - selenium.common.exceptions.SessionNotCreatedException : Message: session not created: This version of ChromeDriver only supports Chrome version 114,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76925094/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com