每隔1秒重复操作某一按钮:
#!/system/bin/sh
i=0
while
i=$((i+1))
do
echo "snapshot $i times"
input tap 400 1240
sleep 1.0
done
按键操作命令:
adb shell input keyevent "value"
value值可以通过按键时打印adb logcat |grep -i "keycode"查找。
点击屏幕命令:
adb shell input tap 400 1240
获得点击屏幕事件的方法:
adb shell getevent
获得点击屏幕计算点击位置的坐标
adb shell getevent | grep -e "0035" -e "0036"
D:\server>adb shell input
usage: input ...
input text <string>
input keyevent <key code number or name>
input [touchscreen|touchpad|touchnavigation] tap <x> <y>
input [touchscreen|touchpad|touchnavigation] swipe <x1> <y1> <x2> <y2> [duration(ms)]
input trackball press
input trackball roll <dx> <dy>
在某坐标点上touch
如在屏幕的x坐标为40,y坐标为210的点上touch一下,命令如下
adb shell sendevent /dev/input/event0 3 0 40
adb shell sendevent /dev/input/event0 3 1 210
adb shell sendevent /dev/input/event0 1 330 1 //touch
adb shell sendevent /dev/input/event0 0 0 0 //it must have
adb shell sendevent /dev/input/event0 1 330 0 //untouch
adb shell sendevent /dev/input/event0 0 0 0 //it must have
注:以上六组命令必须配合使用,缺一不可
细节可参考:
Android自动化测试shell脚本(飞车Asphalt5)
http://blog.csdn.net/lhzhang1985/article/details/6580595
Android adb shell 获得点击屏幕的位置坐标
http://blog.csdn.net/liu_zhen_wei/article/details/12559277
#!/system/bin/sh
i=0
while
i=$((i+1))
do
echo "snapshot $i times"
input tap 400 1240
sleep 1.0
done
按键操作命令:
adb shell input keyevent "value"
value值可以通过按键时打印adb logcat |grep -i "keycode"查找。
点击屏幕命令:
adb shell input tap 400 1240
获得点击屏幕事件的方法:
adb shell getevent
获得点击屏幕计算点击位置的坐标
adb shell getevent | grep -e "0035" -e "0036"
D:\server>adb shell input
usage: input ...
input text <string>
input keyevent <key code number or name>
input [touchscreen|touchpad|touchnavigation] tap <x> <y>
input [touchscreen|touchpad|touchnavigation] swipe <x1> <y1> <x2> <y2> [duration(ms)]
input trackball press
input trackball roll <dx> <dy>
在某坐标点上touch
如在屏幕的x坐标为40,y坐标为210的点上touch一下,命令如下
adb shell sendevent /dev/input/event0 3 0 40
adb shell sendevent /dev/input/event0 3 1 210
adb shell sendevent /dev/input/event0 1 330 1 //touch
adb shell sendevent /dev/input/event0 0 0 0 //it must have
adb shell sendevent /dev/input/event0 1 330 0 //untouch
adb shell sendevent /dev/input/event0 0 0 0 //it must have
注:以上六组命令必须配合使用,缺一不可
细节可参考:
Android自动化测试shell脚本(飞车Asphalt5)
http://blog.csdn.net/lhzhang1985/article/details/6580595
Android adb shell 获得点击屏幕的位置坐标
http://blog.csdn.net/liu_zhen_wei/article/details/12559277