APP——python 启动APP

一、adb命令启动应用

1. 使用os.sysytem()+monkey启动应用

adb shell dumpsys window windows | findstr "Current"    
获取到当前打开app的包名和启动activity名称 
adb shell am activity/service/broadcast -a ACTION -c CATEGORY -n NAME
def open_ATX(devices_id, packageName):
    os.system('adb shell /data/local/tmp/atx-agent server -d')
    os.system('adb shell monkey -p {1} -c android.intent.category.LAUNCHER 1'.format(devices_id, packageName))

if __name__ == '__main__':
    devices_id = 'c2913bcb'
    pkg_ATX = ' com.github.uiautomator'
    open_ATX(devices_id,pkg_ATX)

2. 使用os.sysytem()+am start启动应用

'''
-a android.intent.action.MAIN     决定应用程序最先启动的Activity
-c android.intent.category.LAUNCHER     决定应用程序是否显示在程序列表里
'''
adb shell am start -n package/launch activity
adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n package/launch activity
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值