霍格沃兹测试开发
前提条件:
通讯录添加成员用例步骤
验证点:搜索结果页面联系人不存在
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