selenium.common.exceptions.NoSuchElementException定位元素
摘要:在做web应用的自动化测试时,定位元素是必不可少的,这个过程经常会碰到定位不到元素的情况(报selenium.common.exceptions.NoSuchElementException),一般可以从以下几个方面着手解决: 1.Frame/Iframe原因定位不到元素: 这个是最常见的原因,首先
阅读全文
posted @
2019-12-25 19:01
wenjingtester
阅读(2131)
推荐(0)
ddt数据使用
摘要:with open("C:\\Users\\8000\\PycharmProjects\\xuexi1128\\cwp\\test_data\\cwpdata.txt","r") as fp: fp = fp.readlines() L=[] for i in fp: s = i.replace("
阅读全文
posted @
2019-12-17 13:45
wenjingtester
阅读(203)
推荐(0)
with open(report_abspath,"wb") as fp: OSError: [Errno 22] Invalid argument:报错
摘要:report_path = os.path.join(os.getcwd(),"report1")now = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))report_abspath = os.path.join(rep
阅读全文
posted @
2019-12-16 16:54
wenjingtester
阅读(1182)
推荐(0)
关于Python+selenium 定位浏览器弹窗元素
摘要:链接:https://www.jianshu.com/p/4c3330c1cdb5 (1)div弹窗 (2)新标签页弹窗 (3)alert弹窗 一,div弹窗 div弹窗是浏览器中比较好定位的弹窗,定位的方法与普通的元素一样。不过这里会有一个坑,明明可以找到这个按钮,但是就是定位不到。这个就是因为当
阅读全文
posted @
2019-12-13 18:55
wenjingtester
阅读(1573)
推荐(0)
selenium报错Element is not clickable at point及四种解决方法
摘要:点击报错 使用Selenium时,触发点击事件,经常报如下异常: Element is not clickable at point1原因及解决方法 无外乎四种原因 未加载 没加载出来就等待元素加载出来,再往下执行。 可以使用python库time import time time.sleep(3)
阅读全文
posted @
2019-12-13 13:47
wenjingtester
阅读(2680)
推荐(0)
发送测试报告
摘要:import smtplibfrom email.mime.text import MIMETextimport osdef send_report(report): sender = "000@sfmail.sf-express.com" receiver = "000@sfmail.sf-exp
阅读全文
posted @
2019-12-05 16:49
wenjingtester
阅读(148)
推荐(0)
Appium基础篇-元素定位
摘要:通过id定位 通过工具获取到按钮的 resource-id driver.find_element_by_id('resource-id') 实例: driver.find_element_by_id(' com.android.bbkcalculator:id/clear') 通过class定位
阅读全文
posted @
2019-12-04 15:08
wenjingtester
阅读(497)
推荐(0)
python生成测试报告
摘要:import unittestimport osimport timeimport HTMLTestRunner# 用例路径case_path = os.path.join(os.getcwd())# 报告存放路径report_path = os.path.join(os.getcwd(), 're
阅读全文
posted @
2019-12-02 15:15
wenjingtester
阅读(1553)
推荐(0)
通过discover方式加载某路径下的所有测试用例
摘要:import unittest # discover可以一次调用多个脚本# test_dir 被测试脚本的路径# pattern 脚本名称匹配规则test_dir = "./test_case"discover = unittest.defaultTestLoader.discover(test_d
阅读全文
posted @
2019-11-29 16:48
wenjingtester
阅读(297)
推荐(0)