Android ADB simulates click events of sliding buttons

mock events are all implemented through the input command, starting with the use of the input command:

usage: input … input text & lt; string>

input keyevent & lt; key code number or name>

input tap & lt; x> < y>

input swipe & lt; x1> < y1> < x2> < y2>

1. Keyevent refers to the corresponding android keycode, such as the home key keycode=3 and the back key =4.

please refer to < Android Keycode Details & GT; http://blog.csdn.net/huiguixian/article/details/8550170

is easy to use, for example, if you want to simulate the home button:

adb shell input keyevent 3

please refer to the above article and edit according to the specific keycode.

2. For tap, it simulates events on the touch screen, giving only x and y coordinates.

this x and y coordinate corresponds to the real screen resolution, so it should be seen according to the specific phone. For example, if you want to click the screen (x, y) = (250, 250) position:

adb shell input tap 250 250

3. Swipe is the same as tap, except that it is a simulated sliding event, and the coordinates of starting point and ending point are given. For example, going from screen (250, 250) to screen (300, 300) is

adb shell input swipe 250 250 300 300

Read More: