airTest是一个跨平台的、基于图像识别的UI自动化测试框架,适用于游戏和App,支持平台有Windows、Android和iOShtml
官方文档: http://airtest.netease.com/docs/docs_AirtestIDE-en_US/index.htmlpython
github: https://github.com/AirtestProject/Airtestgit
经常使用的一些操做方法:github
touch
,点击某个位置swipe
,能够从一个位置滑动到另一个位置 wait
,能够等待画面中某个图片出现 exists
,判断画面中是否存在某个图片text
,调用输入法,输入一段文字本章使用airttest对网游征途实现自动进入洞穴打怪,回城,寻找npc卖药等操做windows
全部操做基于ui图像识别,模拟人的行为.服务器无感知,即非入侵式自动化.无封号风险bash
pip3 install airtest pip3 install PyUserInput #Sendkeys python3已经不能使用
#游戏窗口标题正则匹配.链接上后,默认会把窗口置前 connect_device("Windows:///?title_re=征途驱魔人模拟器.*")
#须要传入npc图片的名称和移动到目标位置成功标志图片 def move_to_npc(npc='',existPng=''): #open near player dialog k.tap_key("f") #switch near npc touch(Template(menuDir + "near_player_npc.png")) for i in range(10): indexKey = npc.split("f_")[-1][0] k.tap_key(indexKey) if exists(Template(npc)): touch(Template(npc)) touch(Template("f_move.png")) k.tap_key(k.escape_key) break wait(Template(existPng))
视频连接: http://www.365yg.com/i6596572881549852686/#mid=1605965807164423服务器
github: https://github.com/sanphi/airTestForzhengTuapp