摘要: The public methods represent the services that the page offers 公共方法表示页面提供的服务 Try not to expose the internals of the page 不要暴露页面的细节 Generally don't mak 阅读全文
posted @ 2020-08-22 20:00 Hei蛋炒饭 阅读(1003) 评论(0) 推荐(0) 编辑
摘要: 一、文件上传 上传标签是input时,可以直接使用send_keys(文件path)的方法来进行上传 二、弹框处理 页面操作中,有时会遇到JavaScript生成的alert、confirm以及prompt弹框,可以使用 switch_to.alert() 方法来定位 然后使用 text/accep 阅读全文
posted @ 2020-08-22 14:30 Hei蛋炒饭 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 如何使用Selenium来执行Javascript脚本呢 Selenium中提供了一个方法:execute_script 来执行js脚本 return 可以返回js的返回结果 execute_script: arguments来进行传参 示例: 场景一:页面显示的 数据比较多,需要点击底部的对象,我 阅读全文
posted @ 2020-08-22 13:50 Hei蛋炒饭 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 当我们在执行自动化测试过程中,往往会针对不同的浏览器做兼容性测试,那么我们在代码中,可以针对执行命令传过来的参数,选择对应的浏览器来执行测试用例 代码如下: 在终端中执行命令如上图红框中所示: browser=firefox pytest Test_Window_Frame.py 阅读全文
posted @ 2020-08-22 11:58 Hei蛋炒饭 阅读(119) 评论(0) 推荐(0) 编辑