我是靠谱客的博主 朴素棒棒糖,这篇文章主要介绍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

最后

以上就是朴素棒棒糖最近收集整理的关于APP——python 启动APP的全部内容,更多相关APP——python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(184)

评论列表共有 0 条评论

立即
投稿
返回
顶部