1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| #模拟点击 adb shell input tap 100 100
#滑动 adb shell input swipe x1 y1 x2 y2 adb input touchscreen swipe x1 y1 x2 y2 100
adb shell input swipe 100 100 400 100 300#左往右 adb shell input swipe 400 100 100 100 300#右往左 adb shell input swipe 100 100 100 400 300#上往下 adb shell input swipe 100 400 100 100 300#下往上 adb shell input swipe 100 100 400 400 300#上往下斜 adb shell input swipe 400 400 100 100 300#下往上斜
#长按 adb shell input swipe 100 100 100 100 1000//在100 100位置长按1000毫秒
adb shell input swipe 367 469 367 469 800
#打印所有包名 adb shell pm list packages
-> ~adb shell pm list packages package:com.huawei.floatMms package:com.android.defcontainer package: com.tencent.mm ...
#打印定制包的apk路径 adb shell pm path com.android.phone
-> ~adb shell pm path com.huawei.android.launcher package:/system/app/HwLauncher6.apk
#截图 adb shell screencap /sdcard/screen.png
adb pull /sdcard/screen.png#下载到本地
#获取被点击的位置信息 adb shell getevent
> /dev/input/event0 3 39 3e1 /dev/input/event0 1 14a 1 /dev/input/event0 1 145 1 /dev/input/event0 3 35 406 //x坐标 /dev/input/event0 3 54 1083 //y坐标 /dev/input/event0 0 0 0 /dev/input/event0 3 39 ffffffff /dev/input/event0 1 14a 0 /dev/input/event0 1 145 0 /dev/input/event0 0 0
getevent -l -c 16 输出所有event设备的基本信息
add device 1: /dev/input/event2 name: "hi6421_on" could not get driver version for /dev/input/mouse0, Not a typewriter add device 2: /dev/input/event4 name: "huawei,touchscreen" add device 3: /dev/input/event0 name: "mhl_rcp_dev" could not get driver version for /dev/input/mice, Not a typewriter add device 4: /dev/input/event1 name: "hisi_gpio_key.14" add device 5: /dev/input/event3 name: "hi3630_hi6401_CARD Headset Jack" getevent -c 10 //输出10条信息后退出 getevent -l //将type、code、value以对应的常量名称显示
#使用uiautomator dump 获取app上的页面元素 adb shell uiautomator dump /data/local/tmp/uidump.xml adb shell uiautomator dump /sdcard/dump.xml
|