通过使用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 脚本名字