这个错误让我发疯。我的代码是:
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)
Run Code Online (Sandbox Code Playgroud)
如果我做:
./chromedriver -v
ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-
heads/3945@{#614})
Run Code Online (Sandbox Code Playgroud)
这是正确的版本。
完整的回溯是:
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 …Run Code Online (Sandbox Code Playgroud) python selenium google-chrome selenium-chromedriver selenium-webdriver