python为什么没有点击就触发_python 快速触发adb 命令, 快速点击

import subprocess

import time

# 按照时间来点击,例如点击1秒钟

# def loop_click_for_android(run_time=1):

# res = subprocess.Popen('adb devices', shell=True, stdout=subprocess.PIPE)

# res.stdout.read()

# inputs = str(input("请确保已打开测试页面(y/n): "))

#

# if inputs == "y":

# num = 0

# node_time = time.time()

# start_buttun = subprocess.Popen("adb shell input tap 540 1104", shell=True, stdout=subprocess.PIPE)

# if start_buttun:

# while True:

# result = subprocess.Popen("adb shell input tap 540 1103", shell=True, stdout=subprocess.PIPE)

# if result:

# num += 1

# if node_time + run_time <= time.time():

# break

# else:

# continue

# print("发送点击次数{}".format(num)) # 次数统计并不准确

# else:

# print("程序关闭~")

# exit(1)

#

#

# loop_click_for_android()

# 按照次数来点击它

def loop_click_for_android(run_num=30):

res = subprocess.Popen('adb devices',

shell=True, stdout=subprocess.PIPE)

res.stdout.read()

num = 0

node_time = time.time()

start_buttun = subprocess.Popen("adb shell input tap 540 1104", shell=True, stdout=subprocess.PIPE)

if start_buttun:

while True:

result = subprocess.Popen("adb shell input tap 540 1104", shell=True, stdout=subprocess.PIPE)

if result:

num += 1

if num == run_num:

break

else:

continue

over_time = time.time()

print("{}次点击的运行时间是:{}".format(run_num, over_time-node_time)) # 次数统计并不准确

loop_click_for_android()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值