python - 此版本的 ChromeDriver 仅支持 Chrome 版本 79 - Python

标签 python selenium google-chrome selenium-webdriver selenium-chromedriver

这个错误让我发疯。我的代码是:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import chromedriver_binary
from selenium.webdriver.common.by import By
import time
from influxdb import InfluxDBClient
chrome_options = Options()
chrome_options.add_argument("--headless")
chromedriver_binary = 
"/home/dario/scripts/cron_run/web_app_login_checker/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)

如果我这样做:

 ./chromedriver -v
 ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch- 
 heads/3945@{#614})

这是正确的版本。

完整的回溯是:

    Traceback (most recent call last):
    File "grafana.py", line 12, in <module>
    driver = webdriver.Chrome(chromedriver_binary, options=chrome_options)
    File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
    packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
    File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
   self.start_session(capabilities, browser_profile)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 252, in 
   start_session
   response = self.execute(Command.NEW_SESSION, parameters)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
   self.error_handler.check_response(response)
   File 
   "/home/dario/scripts/cron_run/web_app_login_checker/lib/python3.6/site- 
   packages/selenium/webdriver/remote/errorhandler.py", line 242, in 
   check_response
   raise exception_class(message, screen, stacktrace)
   selenium.common.exceptions.SessionNotCreatedException: Message: session 
   not created: This version of ChromeDriver only supports Chrome version 
   79

Stack Overflow 上已经讨论过的主题都没有帮助我。

最佳答案

问题出在 Chrome 浏览器版本上,而不是 ChromeDriver 版本上。您需要将其更新到版本 79,或降级 ChromeDriver。您可以找到here匹配的版本。

关于python - 此版本的 ChromeDriver 仅支持 Chrome 版本 79 - Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59017777/

相关文章:

python - 按地址获取 'erc-20' 交易的列表

python - Python 中的二进制 16

java - Selenium Webdriver(JAVA) 嵌套元素

python selenium 远程 webdriver safari 驱动程序

javascript - 使用 JavaScript/JQuery 将 html 表格数据导出到 Excel 在 chrome 浏览器中无法正常工作

python - Jupyter打印语句问题

python - 将 POS 标签从 TextBlob 转换为 Wordnet 兼容输入

java - Selenium 网格,线程 "main"java.lang.NoSuchMethodError 中出现异常

html - 浏览器的 1px 计算问题(亚像素问题)

html - CSS选框,如何使文本从底部移动到顶部