霍格沃兹测试开发
前提条件:
实现打卡功能
验证点:提示【外出打卡成功】
caps["noReset"] = "true"
# 等待页面空闲的时间
caps['settings[waitForIdleTimeout]'] = 0
caps['skipServerInstallation'] = ‘true' # 跳过 uiautomator2 server的安装
caps['skipDeviceInitialization'] = ‘true' # 跳过设备初始化
caps['dontStopAppOnReset'] = ‘true' # 启动之前不停止app
def draw_rectangle_in_screenshot(self, element, color_rgb=(255, 0, 0)):
'''在图上上画矩形
start_point: 起点的坐标,tuple 类型,例如:(100, 100)
end_point: 终点的坐标,tuple 类型,例如:(200, 200)
color_rgb: 画线对应的rgb颜色 例如:(0, 255, 0)
'''
start_x = element.location.get("x")
start_y = element.location.get("y")
end_x = element.size.get("width") + start_x
end_y = element.size.get("height") + start_y
start_point = (start_x, start_y)
end_point = (end_x, end_y)
img_path = "tmp.png"
self.screenshot(img_path)
# 读取图片
image = cv2.imread(img_path)
# 画矩形
cv2.rectangle(image, start_point, end_point, color_rgb, 5)
# 写到文件中
cv2.imwrite(img_path, image)
return img_path