# 失败截图def fail_img_screenshot(self, Image_name): try: now = time.strftime('%Y-%m-%d_%H-%M-%S') # 截图的方法中不允许存在以下符号\ / : * ? # ” < > | self.driver.get_sc Read More
posted @ 2020-12-03 23:34
sriver_dl
Views(664)
Comments(0)
Diggs(0)
首先断言是用于测试用例是否成功的判断条件 ①当断言失败时会抛出异常测试用例执行失败,我们如果要失败截图那么就需要加异常处理机制与截图的语句,然后等图截好以后重新将异常抛出,如下所示 try: asserIn(u'登录成功',self.driver.title) except Exception as Read More
posted @ 2020-12-03 22:04
sriver_dl
Views(2491)
Comments(0)
Diggs(0)
有时需要使用定位方法,在具体通过哪种定位方式(id 或 name)根据实际场景而定位,By 就可以设置定位策略。find_element(By.ID,"kw")find_element(By.NAME,"wd")find_element(By.CLASS_NAME,"s_ipt")find_elem Read More
posted @ 2020-12-03 16:04
sriver_dl
Views(248)
Comments(0)
Diggs(0)
解决方法一: 第一步:F12>>选择sources 第二步:按“ctrl+\”键暂停悬浮页面 第三步:选择Elements,在按照平时操作进行定位即可 解决方法二:先按下F12在按下F8 Read More
posted @ 2020-12-03 15:56
sriver_dl
Views(1148)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号