今日问题:解决最新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.运行代码---成功

相关推荐
weixin_440784119 分钟前
Java基础常见题
java·开发语言·python·java基础
跨境小彭36 分钟前
Python列表去重的6种高效方法(含保留顺序+性能对比)
开发语言·python
今天AI了吗42 分钟前
Python 基础语法从入门到使用详解
开发语言·人工智能·python
苏灿烤鱼1 小时前
从微信公众号内容到视频号视频:自动化视频生成的技术实现
人工智能·python·ffmpeg
金銀銅鐵1 小时前
[Python] 借助 Pillow 和 NumPy 生成与斐波那契数列有关的图案
python·数学
雪之下雪乃的代码日记1 小时前
Python快速入门(Java开发者版)
java·开发语言·笔记·python
IT小白杨2 小时前
2026年短视频平台风控技术解析:设备指纹体系、行为建模与环境隔离的边界在哪里
chrome·经验分享·架构·音视频·安全架构·指纹浏览器
gb42152872 小时前
python中pypdf库和langchain-unstructured库在解析pdf文件的时候的区别?
python·langchain·pdf
weixin199701080162 小时前
☁️《抖店API基础¥0.018/百次·增值¥0.05/百次:云内云外价差架构实战》(附Python源码)
开发语言·python·架构
0566462 小时前
Python数据结构——循环队列
python·学习