ADB

adb的全称为Android Debug Bridge,就是起到调试桥的作用。借助adb工具,我们可以管理设备或手机模拟器的状态。还可以进行很多手机操作,如安装软件、系统升级、运行shell命令等等。其实简而言说,adb就是连接Android手机与PC端的桥梁,可以让用户在电脑上对手机进行全面的操作。

常用adb指令:

import os

# os.system("adb connect 127.0.0.1:7555")  # 使用TCP/IP连接设备 例如网易MM模拟器

# os.system("adb devices")  # 查看已连接色设备

# os.system("adb shell input tap 200 50")  # 点击屏幕X200,Y50处

# os.system("adb shell input swipe 55 212 630 217.6 100000")  # 将X55,Y212拖到X630,Y217.6处,耗时100000

# os.system("adb shell input swipe 55 212 630 217.6)  # 将X55,Y212拖到X630,Y217.6处

# os.system("adb shell input keyevent 3")  # HOME键

# os.system("adb shell input keyevent 4")  #  返回已键

# os.system("adb shell input keyevent 24")  #  音量+

# os.system("adb shell input keyevent 25")  #  音量—

# os.system("adb shell input keyevent 26")  #  打开/关闭屏幕

# os.system("adb shell ps")  # 查看进程

# os.system("adb shell ps|grep xxxx")  # 查看xxxx的进程

# os.system("adb shell kill 5450")  # 结束PID为5440的进程

# os.system("adb start 5450")  # 启动PID为5450的进程

# os.system('adb shell dumpsys window windows | findstr "Current"')  # 获取当前打开的应用程序的package和launch activity

# os.system("adb shell am start -n xxxx/xxxx")  # 启动xxxx应用的xxxxx activity

# os.system("adb shell am broadcast -a clipper.get")  # 获取粘贴板的内容  需要安装一个软件https://github.com/majido/clipper

# os.system('adb shell am broadcast -a clipper.set -e text "this can be pasted now"')  # 设置粘贴板的内容

  

转载于:https://www.cnblogs.com/LicwStack/p/10828188.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值