android adb 模拟点击、滑动、输入、按键的操作

//模拟输入“001” 
adb shell input text “001”

//模拟home按键 
adb shell input keyevent 3

//模拟点击(540, 1104)坐标 
adb shell input tap 540 1104

//模拟滑动,从(250,250)滑动到(300,300) 
adb shell input swipe 250 250 300 300
--------------------- 
作者:阳光柠檬_ 
来源:CSDN 
原文:https://blog.csdn.net/liukang325/article/details/79268173 
版权声明:本文为博主原创文章,转载请附上博文链接!

=============================================

以下是mac写的一个自动小程序,sh的后缀名。执行时   bash  auto.sh.

#!/bin/bash
echo "开始执行"
COUNTER=0
while [ $COUNTER -lt 1000000 ]
do
    COUNTER=`expr $COUNTER + 1`
    echo 第 $COUNTER 次执行
    echo 开始
    adb shell input tap 850  2350
    sleep 8
    echo 向右
    adb shell input swipe 100 210 705 310
    sleep 1
    echo 向右
    adb shell input swipe 720 210 305 110
    sleep 2
    echo 向左
    adb shell input swipe 408 401 230 206
    sleep 1
    echo 向右
    adb shell input swipe 200 110 505 610
    echo 向右
    adb shell input swipe 200 110 505 610
    sleep 20
    echo 再来一次
    adb shell input tap 1100 2200
    sleep 1
done

猜你喜欢

转载自blog.csdn.net/u011368551/article/details/85060560