https://blog.csdn.net/yuhavefreedom/article/details/130830499
原因:selenium版本过高
from selenium import webdriver
from selenium.webdriver.common.by import By# 打开自定义配置
options = webdriver.ChromeOptions()# 设置浏览器不会关闭
options.add_experimental_option('detach', True)# 禁用浏览器扩展
options.add_argument('--disable-extensions')# 禁用浏览器弹窗
options.add_argument('--disable-popup-blocking')# 设置浏览器UA
options.add_argument('--user-agent=Mozilla/5.0(windows NT 10.0; Win64; X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36')
driver = webdriver.Chrome(options=options)
driver.maximize_window()# 用get打开百度页面
driver.get("http://www.baidu.com")
driver.find_element(By.ID, "kw").send_keys('python')
driver.find_element(By.ID, "su").click()