20201009·selenium学习笔记
seleniumbase
一个基于Selenium和unittest单元测试框架的一个测试框架SeleniumBase,一些功能和API在探索中
1.安装
pip3 install seleniumbase
- 安装不同浏览器驱动
seleniumbase install chromedriver
seleniumbase install geckodriver
seleniumbase install edgedriver
seleniumbase install iedriver
seleniumbase install operadriver
- 缓慢执行,元素高亮
pytest my_first_test.py --demo_mode
- 错误暂停脚本
pytest my_first_test.py --pdb -s
“c”:继续
“s”:步骤
“n”: 下一步
- 利用pytest 的 pytest-thml插件生成测试报告
pytest test_suite.py --html=report.html
- 代码demo
from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):#必须以test开头
# 打开网页,参数1:url,默认为chrome浏览器