pycharm如何安装selenium

pycharm中打开一个项目后,点击Setting(ALT+Ctrl+S快捷键)

然后点击install package完成后点击关闭这个窗口,就可以在代码中使用selenium了

成功后出现如下界面

编写一段正常可以运行操作chorme浏览器的

python 复制代码
from selenium import  webdriver
# 指定ChromeDriver的路径

driver = webdriver.Chrome()
driver.get('https://www.baidu.com')  # 打开登录页面
print(driver.title)
driver.quit()

然后我运行后就出现一个问题

The chromedriver version (127.0.6533.99) detected in PATH at D:\Program Files\Python312\chromedriver.exe might not be compatible with the detected chrome version (128.0.6613.120); currently, chromedriver 128.0.6613.119 is recommended for chrome 128.*, so it is advised to delete the driver in PATH and retry

大概意思就是我的chrom浏览器的driver没匹配上,重新去下载一个chromedriver.exe放在D:\Program Files\Python312中

这里插入一下chromedriver的下载地址

Chrome for Testing availability

更新好chromeDriver后,一切就正常了

这样就做好了一个python控制Chrome浏览器的插件

相关推荐
墨白曦煜30 分钟前
穿透 IDE 的障眼法:Git 四大工作区与核心数据流转解析
ide·git
2601_9622953314 小时前
如何python实现网页的自动化
python·selenium·beautifulsoup·requests·网页自动化
泡泡鱼(敲代码中)17 小时前
Python语法技术学习笔记
开发语言·笔记·python·学习·pycharm
郝学胜_神的一滴18 小时前
Effective Python 条款 8: 同时遍历多组序列:zip 与 zip_longest 的实战避坑指南
python·pycharm
承渊政道18 小时前
【Python编程—从入门到实践】(Python字典:从基础语义到现代工程实践)
开发语言·python·pycharm·字典·嵌套
程序员小远1 天前
自动化测试用例编写实例详解
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
kqz20141 天前
Android Studio Commit 面板临时文件.gitignore
ide·android studio·intellij-idea
天天喝旺仔1 天前
AI 编程实战:用 Cursor + Claude Code + Copilot 把效率翻倍
ide·chatgpt·prompt·copilot·ai编程
captain3761 天前
网络编程(1)
java·网络·ide·java-ee