airtest中断言存在assert_exists、断言包含assert_equal和判断是否存在exists的使用

#断言存在

assert_exists(Template(r"tpl1611284952927.png", record_pos=(0.062, -0.287), resolution=(720, 1280)), "请填写测试点")

#断言包含
value = poco("com.createwit.kaidan:id/synthesize_tv").attr("text")
try:
  assert_equal(value, "综合", "按钮值为:综合")
except AssertionError:
  print("按钮值断言失败")


#判断是否存在某个按钮,具有则点击,不具有则执行其他操作
if exists(Template(r"tpl1611283287349.png", record_pos=(0.004, -0.157), resolution=(720, 1280))) :
  touch exists(Template(r"tpl1611283287349.png", record_pos=(0.004, -0.157), resolution=(720, 1280)))
else:
  print("没有这个选项")

posted @ 2021-01-22 11:32  一个也不能少  阅读(4252)  评论(0编辑  收藏  举报