今日问题:解决最新Chrome和chromedriver版本对不上的问题

python 复制代码
from selenium import webdriver
#from .chrome.webdriver import WebDriver as Chrome
from selenium.webdriver.common.by import By
from time import sleep
driver = webdriver.Chrome()

driver.get("https://www.baidu.com/")
driver.maximize_window()#窗口最大化
sleep(1)
element = driver.find_element(by=By.ID,value="kw")
element.send_keys("selenium")
print(type(element))
driver.find_element(by=By.ID,value="su").click()

sleep(3)
driver.quit()

代码执行报错

The chromedriver version (114.0.5735.90) detected in PATH at C:\Users\jeffky\Desktop\selenium\webdriver\chromedriver.exe might not be compatible with the detected chrome version (119.0.6045.200); currently, chromedriver 119.0.6045.105 is recommended for 。。。

报错分析结果:Chrome和chromedriver版本对不上的问题

解决:

1.打开网站: ChromeDriver - WebDriver for Chrome - Downloads

2.若列表没有你的版本,点击:the Chrome for Testing availability dashboard

3.复制链接下载

4.将下载的chromedriver替换本地版本低的chromedriver

5.运行代码---成功

相关推荐
Zonda要好好学习16 分钟前
Python入门Day5
python
电商数据girl1 小时前
有哪些常用的自动化工具可以帮助处理电商API接口返回的异常数据?【知识分享】
大数据·分布式·爬虫·python·系统架构
CoooLuckly1 小时前
numpy数据分析知识总结
python·numpy
超龄超能程序猿2 小时前
(六)PS识别:源数据分析- 挖掘图像的 “元语言”技术实现
python·组合模式
amazinging2 小时前
北京-4年功能测试2年空窗-报培训班学测开-第四十四天
python·学习·appium
UrbanJazzerati2 小时前
Xlwings安装报错:Connection timed out & WinError 32?一招解决你的安装难题!
python
Tipriest_3 小时前
Python异常类型介绍
开发语言·python·异常
前端付豪3 小时前
21、用 Python + Pillow 实现「朋友圈海报图生成器」📸(图文合成 + 多模板 + 自动换行)
后端·python
猿榜3 小时前
魔改编译-永久解决selenium痕迹(二)
javascript·python
广东数字化转型3 小时前
java jar 启动应用程序
开发语言·python