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浏览器的插件

相关推荐
Super 含1 天前
Android 包体积优化(一):APK 到底大在哪里?从 APK 结构到体积分析
android·ide·vscode
赵广陆1 天前
企业实战:Milvues向量数据库实践
数据库·pycharm·langchain
Promising_GEO1 天前
新电脑科研环境配置指南:Miniforge + PyCharm + GitHub 从安装到可用
ide·python·pycharm·github·地理
舞动青春881 天前
vscode copilot配置kimi k3
ide·vscode·copilot
love530love1 天前
彻底清理 Windows 右键“打开方式“中的重复/失效程序项(PyCharm 多版本残留实战 + 自动化脚本)
运维·人工智能·windows·pycharm·jetbrains·toolbox
爱上纯净的蓝天1 天前
AtomCode 多语言开发支持:一个 AI IDE 搞定全栈开发
ide·多语言·全栈开发·atomcode
小小啊python2 天前
IDEA中SpringBoot项目配置热部署
java·ide·intellij-idea·springboot·热部署
祉猷并茂,雯华若锦2 天前
Selenium与Playwright元素定位终极对决
selenium·测试工具
树码小子3 天前
Pycharm解释器配置问题解决
ide·python·pycharm