python 操作手机

时间:2023-03-09 18:41:53
python 操作手机

https://blog.****.net/wave_1102/article/details/41630469

import os
import time
import subprocess
i = 0
#每次操作的间隔时间取决于手机配置,配置越高时间越短
# sleep_time = 0.5
# while 1:
# #用popen设置shell=True不会弹出cmd框
# process = subprocess.Popen('adb shell input tap 14 1402',shell=True)
# time.sleep(sleep_time)
# process = subprocess.Popen('adb shell input keyevent KEYCODE_BACK', shell=True)
# time.sleep(sleep_time)
# process = subprocess.Popen('adb shell input tap 375 1402', shell=True)
# time.sleep(sleep_time)
# process = subprocess.Popen('adb shell input keyevent KEYCODE_BACK', shell=True)
# time.sleep(sleep_time)
# #os.system('adb shell input tap 14 1402')
# #os.system('adb shell input keyevent KEYCODE_BACK')
# #os.system('adb shell input tap 375 1402')
# i+=1
# print str(i) + 'clicks have been completed'
# os.system('adb shell input tap 100 100')
process = subprocess.Popen('adb shell input tap 100 100',shell=True)
time.sleep(5)
process = subprocess.Popen('adb shell input tap 752 1919',shell=True)
time.sleep(10)
process = subprocess.Popen('adb shell input tap 607 465',shell=True)
time.sleep(10)