AirTest(⾃动跑测试⽤例)
AirTest介绍:
Airtest是⼀款基于Python的、跨平台的UI⾃动化测试框架,基于图像识别原理,适⽤于游戏和App。
访问Github上的,可以获得更多信息,也欢迎各位帮忙完善项⽬,提交PR,也可以在issues页⾯中。
python入门教程app
如何快速上⼿
linux系统安装网卡驱动⾸先,想要编写Airtest脚本,需要具备基础的Python语法知识。虽然借助我们的AirtestIDE提供的录制功能,也能简单地根据操作步骤录制出可以回放操作的脚本,但是通常来说,熟练掌握Python语法能够帮助我们写出应⽤更⼴泛、更不容易出错的脚本。
若对 Python 语法不熟悉,⽹络上有不少⾮常优秀的Python教程可以学习,例如。
关于Airtest项⽬的安装、基本使⽤⽅法和简单的例⼦,请查看Airtest⽂档页的章节。
官⽅⽹址(必看)
airtest介绍与脚本⼊门
模拟点击
chown root shell
Airtest作为⾃动化测试框架,模拟的是⼈的操作,常见接⼝主要有:
touch点击某个位置,可以设定被点击的位置、次数、按住时长等参数
echarts地图轨迹
swipe从⼀个位置滑动到另外⼀个位置
text调⽤输⼊法输⼊指定内容
keyevent输⼊某个按键响应,例如回车键、删除键shadow of war
wait等待某个指定的图⽚元素出现
snapshot对当前画⾯截⼀张图
其他
使⽤本地python环境运⾏脚本
1.部署Python环境,安装Python(
2.7 或 <=
3.6),Mac 安装 brew install python3
windows注意配置环境变量,C:\Python27\Scripts、C:\Python27
2.pip install airtest
3.pip install pocoui
4.跑脚本
airtest run E:\AutoTest\Normal.air --device Android:///设备信息
airtest run E:\AutoTest\Normal.air --device Android:///设备信息 --log log/
airtest run E:\AutoTest\Normal.air --device Android:///设备信息 --log log/ --outfile log.html /// 运⾏结果
adb devices 查看设备信息
如果你连接了多个设备,或者有远程设备,那么使⽤参数来指定要连接的设备
# connect an android phone with adb
init_device("Android")
# or use connect_device api with default params
connect_device("android:///")
# connect a remote device using custom params
connect_device("android://adbhost:adbport/1234566?cap_method=javacap&touch_method=adb")access端口是什么意思

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。