一、框架的搭建
1.查看本机的chrome浏览器版本
2.下载对应的chrome驱动,并将放在python的目录下
3.查看python版本号,在cmd窗口输入:python -V ;python --version
4.查看selenium版本号,在cmd窗口输入:pip show selenium
5.查看selenium是否安装成功,import(selenium),help(selenium)可以查看selenium版本号
二、用例的编写
1.用例的关键要素(导入依赖、创建driver、执行自动化步骤、断言)
2.selenium介绍,小白入门:https://selenium-python.readthedocs.io
3.隐式等待和显示等待
4.元素定位:在console里输入document.querySelectorAll(".active")=$(''.active"), css定位
document.querySelector(".active")是查找一个元素,css定位
$(['data-name=霍格沃兹测试学院'])
$x('//*[@data-name="霍格沃兹测试学院"]') xpath定位