sugh
import time
import subprocess

sleep_time = 10

while 1:
    # 用popen设置shell=True不会弹出cmd框
    process = subprocess.Popen(\'adb shell input touchscreen swipe 930 880 930 380\', shell=True)
    time.sleep(sleep_time)
 

 

  • 模拟滑动触屏操作
adb shell input touchscreen swipe 930 880 930 380 //向上滑
adb shell input touchscreen swipe 930 880 330 880 //向左滑
adb shell input touchscreen swipe 330 880 930 880 //向右滑
adb shell input touchscreen swipe 930 380 930 880 //向下滑
  • 模拟鼠标操作
adb shell input mouse tap 100 500

100是x,500是y。
原点在屏幕左上角。

 

 在adb文件夹下建立一个python文件

import os
os.system(\'adb shell input tap 100 100\');

 

运行脚本,发现与在命令行输入相同语句有同样的效果。

2、也可以使用subprocess.Popen,最简单使用方式如下,设置shell=True,就不会弹出cmd框

process = subprocess.Popen(\'adb shell input touchscreen swipe 930 880 930 380\', shell=True)

分类:

技术点:

相关文章:

  • 2021-09-11
  • 2021-12-21
  • 2021-10-09
  • 2022-12-23
  • 2021-08-23
  • 2021-09-19
  • 2021-08-23
  • 2021-11-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
相关资源
相似解决方案