PyCharm+Selenium+Pytest配置小记

1、下载ChromeDriver:

Chrome130以后的Driver下载:

Chrome for Testing availabilityhttps://googlechromelabs.github.io/chrome-for-testing/

(1)查看自己Crome浏览器的版本:设置-->关于 Chrome;

(2)选择大致一样的版本;

(3)复制链接并打开,自动下载。

2、解压缩并放置到Script目录下:

(1)解压缩包;

(2)将文件夹中的exe放置到Script目录下。

3、查看PyCharm项目的解释器

现在下载PyCharm后,好像这两个解释器会直接携带。如果没有的话,可以在右上角添加。

4、测试打开Chrome浏览器的脚本

python 复制代码
import time
from selenium import webdriver
driver = webdriver.Chrome() # 启动浏览器
driver.get("https://www.baidu.com") # 打开某个网址
time.sleep(2)
driver.quit() # 关闭浏览器
相关推荐
慧都小项2 天前
Python 跨文件重构怎么验证?PyCharm 用法查找、重构预览与测试流程
python·重构·pycharm·单元测试
Xiu Yan2 天前
Python 数据分析:Pandas DataFrame 零基础入门教程
python·jupyter·pycharm·numpy·pandas
ai大模型-探索者2 天前
Git在PyCharm中的使用完全指南
pycharm·gitee
把头塞进显示器2 天前
电商平台-测试报告
python·selenium·pytest
霍格沃兹测试学院-小舟畅学3 天前
UI 测试的语义断言:Midscene aiAssert 比像素比对稳在哪、又会骗在哪
人工智能·测试工具
zuozewei3 天前
附录 A:主流工具对比选型表
人工智能·测试工具
我的xiaodoujiao3 天前
Django 基础知识详细图文教程 10-Django 模板引擎 3
后端·python·测试工具·django
Xiu Yan3 天前
Python 数据分析:Pandas Series 零基础入门教程
python·jupyter·pycharm·numpy·pandas
霍格沃兹测试学院-小舟畅学3 天前
Google 开源 ARTEMIS:AI Agent 如何接管 Android 真机测试?
人工智能·测试工具
Liaiyang663 天前
# 自研 AST 容错初筛工具:横向评测 Django、PyTorch、TensorFlow 三大开源 Python 框架异常收容风险
python·测试工具·自动化·开源软件·代码规范·devops·代码复审