大家好,又见面了,我是你们的朋友全栈君。
目录 一、下载Android SDK 二、添加环境变量 三、测试adb环境 四、adb详细命令 五、python操作app的思路 六、python如何使用adb命令
import os, time
def execute(cmd):
command = "adb shell {}".format(cmd)
print(command)
os.system(command)
if __name__ == '__main__':
# 启动王者荣耀app
execute('am start -n com.tencent.wangzherongyao')
time.sleep(1)
# 点击app中的某个位置
execute('input tap 33 4545')
time.sleep(0.5)
# 输入文字
execute('input text wangzherongyao')
time.sleep(0.5)
# 点击发送
execute('input tap 600 500')
import subprocess
//也设置shell=True,就不会弹出cmd框
process = subprocess.Popen('adb shell input tap 14 1402',shell=True)
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/169898.html原文链接:https://javaforall.cn