Android自动化测试MonkeyRunner
16lz
2021-01-24
这两天正在学习Android的自动化测试工具MonkeyRunner,以下是我的一些学习记录:
1.首先启动emulator,然后把手机设备连接至电脑。
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice
device=MonkeyRunner.waitForConnection() //连接手机设备
device.installPackage("../XX.apk")//安装apk包到手机设备
device.startActivity
(component="com.example.android.apis/com.example.android.apis.ApiD
emos")//以ApiDemos为例,打开ApiDemos
device.reboot()//手机设备重启
device.touch(300,300,'DOWN_AND_UP')
MonkeyRunner.alert("hello")//在emulator上会弹出消息提示
device.press('KEYCODE_BACK', 'DOWN_AND_UP')
device.type('hello')//向编辑区域输入文本'hello'
1.首先启动emulator,然后把手机设备连接至电脑。
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice
device=MonkeyRunner.waitForConnection() //连接手机设备
device.installPackage("../XX.apk")//安装apk包到手机设备
device.startActivity
(component="com.example.android.apis/com.example.android.apis.ApiD
emos")//以ApiDemos为例,打开ApiDemos
device.reboot()//手机设备重启
device.touch(300,300,'DOWN_AND_UP')
MonkeyRunner.alert("hello")//在emulator上会弹出消息提示
device.press('KEYCODE_BACK', 'DOWN_AND_UP')
device.type('hello')//向编辑区域输入文本'hello'
更多相关文章
- Android(安卓)DeviceUtils-设备相关工具类
- js 判断手机操作系统(ios或Android)
- android中VideoView无法播放此视频
- Android之SharedPreferences对参数数据的存取
- Android手机客户端通过JSP实现与Tomcat服务器端通信(Msql数据库,Js
- Flutter 在Android(安卓)Studio中找不到真机设备
- Android(安卓)setTextColor 不生效
- Android获取手机联系人的方法
- Android(安卓)刷机Nexus5 4.4.3