airtest找图切图比较便利但是兼容性不太好
他也有个poco的找控件模式
代码初级没啥东西 主要是学习的一个记录吧 先记录下 看看学习过程的变化
# -*- encoding=utf8 -*- __author__ = "Administrator" from airtest.core.api import * from airtest.core.api import * from airtest.core.android.android import Android from poco.drivers.unity3d import UnityPoco import random auto_setup(__file__) keyevent("home") touch(Template(r"tpl1639543860629.png", record_pos=(0.116, 0.095), resolution=(1080, 1920))) sleep(random.randint(8,10)) #等一会防止app加载ad慢 while 1: try: if exists(Template(r"tpl1639550991634.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639543931652.png", record_pos=(0.269, -0.633), resolution=(1080, 1920))) if exists(Template(r"tpl1639546343664.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639546343664.png", record_pos=(-0.06, -0.34), resolution=(1080, 1920))) if exists(Template(r"tpl1639543977218.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639543977218.png", record_pos=(-0.008, -0.34), resolution=(1080, 1920))) sleep(random.randint(60,65)) #等一会防止app加载ad慢 if exists(Template(r"tpl1639546473137.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639546473137.png", record_pos=(0.007, -0.334), resolution=(1080, 1920))) sleep(random.randint(60,65)) #等一会防止app加载ad慢 if exists(Template(r"tpl1639560033199.png", record_pos=(0.362, -0.756), resolution=(1080, 1920))): touch(Template(r"tpl1639560033199.png", record_pos=(0.003, 0.327), resolution=(1080, 1920))) if exists(Template(r"tpl1639562630593.png", record_pos=(0.362, -0.756), resolution=(1080, 1920))): touch(Template(r"tpl1639562630593.png", record_pos=(0.015, 0.406), resolution=(1080, 1920))) if exists(Template(r"tpl1639558318555.png", record_pos=(0.362, -0.756), resolution=(1080, 1920))): touch(Template(r"tpl1639558318555.png", record_pos=(0.397, -0.795), resolution=(1080, 1920))) if exists(Template(r"tpl1639544062808.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639544062808.png", record_pos=(0.397, -0.795), resolution=(1080, 1920))) if exists(Template(r"tpl1639544076420.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639544076420.png", record_pos=(0.394, -0.798), resolution=(1080, 1920))) if exists(Template(r"tpl1639544099741.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639544099741.png", record_pos=(0.38, -0.603), resolution=(1080, 1920))) if exists(Template(r"tpl1639544114198.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639544114198.png", record_pos=(0.378, -0.597), resolution=(1080, 1920))) # if exists(Template(r"tpl1639558483557.png", record_pos=(0.474, -0.787), resolution=(1080, 1920))) # touch(Template(r"tpl1639558483557.png", record_pos=(0.378, -0.597), resolution=(1080, 1920))) if exists(Template(r"tpl1639544127658.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639544127658.png", record_pos=(0.001, 0.04), resolution=(1080, 1920))) if exists(Template(r"tpl1639546286735.png", record_pos=(-0.152, -0.644), resolution=(1080, 1920))): touch(Template(r"tpl1639546286735.png", record_pos=(-0.003, 0.044), resolution=(1080, 1920))) except Exception as e: print("执行过程出现错误" + str(e))