python模拟android屏幕高频点击工具
2018-02-06 00:00
309 查看
一、环境
windows 10 + python3.6
二、需求
1、模拟android设备高频点击事件;
2、模拟规定次数的点击事件或模拟规定时间内的点击事件;
三、code
1、模拟规定时间内的点击事件
2、模拟规定次数的点击事件
windows 10 + python3.6
二、需求
1、模拟android设备高频点击事件;
2、模拟规定次数的点击事件或模拟规定时间内的点击事件;
三、code
1、模拟规定时间内的点击事件
#!/usr/bin/env python3 # coding=utf-8 import subprocess import time def loop_click_for_android(run_time=5): 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 600 1660") if start_buttun: while True: result = subprocess.Popen("adb shell input tap 600 1660") 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()
2、模拟规定次数的点击事件
# !/usr/bin/env python3 # coding=utf-8 import subprocess import time def loop_click_for_android(run_num=150): 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 600 1660") if start_buttun: while True: result = subprocess.Popen("adb shell input tap 600 1100") if result: num += 1 if num == run_num: break else: continue over_time = time.time() print("{}次点击的运行时间是:{}".format(run_num, over_time-node_time)) # 次数统计并不准确 else: print("程序关闭~") exit(1) loop_click_for_android()
相关文章推荐
- Android通过代码模拟物理、屏幕点击事件
- 【Android】代码实现模拟屏幕点击和键盘按键事件
- Android在任何地方模拟点击屏幕
- 【Android】技术调研:用代码模拟屏幕点击、触摸事件
- Android模拟屏幕点击input tap替代解决方案
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- android 模拟屏幕点击
- Android代码模拟物理、屏幕点击事件
- Android模拟屏幕点击,滑动等事件
- Android 模拟屏幕点击和物理按键方式
- 【Android】技术调研:用代码模拟屏幕点击、触摸事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android通过代码模拟物理、屏幕点击事件
- Android代码模拟物理、屏幕点击事件