介绍
input是android中模拟外设事件的特殊命令, 用于模拟遥控器、键盘、鼠标的各种按键操作,自动化测试常常需要用到该指令。 input可执行文件放在/system/bin目录,本次介绍的input命令行基于Android6.0。
使用说明
input功能集合
#input
Usage: input [<source>] <command> [<arg>...]
The sources are:
mouse
keyboard
joystick
touchnavigation
touchpad
trackball
stylus
dpad
touchscreen
gamepad
The commands and default sources are: ## 不指定source时,命令的默认输入设备类型为:
text <string> (Default: touchscreen)
keyevent [--longpress] <key code number or name> ... (Default: keyboard)
tap <x> <y> (Default: touchscreen)
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll <dx> <dy> (Default: trackball)