monkeyrunner 自动安装app和卸载app操作

通过使用monkeyrunner 实现app的安装卸载操作

from com.android.monkeyrunner import MonkeyRunner as mr
from com.android.monkeyrunner import MonkeyDevice as md
print(‘connet devices....‘)
device = mr.waitForConnection()
print(‘start install app...‘)
device.installPackage(r‘F:\monkeyrunner\xxx.apk‘) 
print(‘launch app...‘)
package = ‘com.xxx.xxx‘ #包名
activity = ‘xxxx‘ # 起始acivity
runComponent = package + ‘/‘ + activity
device.startActivity(component=runComponent) 
print(‘succss app....‘)
mr.sleep(3)
device.removePackage(‘com.jinxin.android‘)
print(‘remove app sucss...‘)

在命令行输入monkeyrunner 脚本名字

monkeyrunner 自动安装app和卸载app操作

上一篇:Appium appium 安装不了


下一篇:Android-Android Studio 3.0找不到Android Device Monitor