赞
踩
注意:Windows下执行shell命令,可以借助Git Bash Here进行执行
adb shell "input swipe 540 1000 540 500 1000"
while true;do adb shell "input swipe 540 1000 540 500 1000";done
while true;do adb shell "input swipe 540 1000 540 2000 1000";done
while true;do adb shell dumpsys meminfo com.bs.finance | grep "Dalvik Heap";done
Dalvik Heap 21634 21608 0 365 31127 15564 15563
Dalvik Heap 14610 14544 0 284 30798 15399 15399
Dalvik Heap 14458 14392 0 284 30825 15413 15412
Dalvik Heap 14458 14392 0 284 30797 15399 15398
shenyf@DESKTOP-5N7A05K MINGW64 /e
click(){
local index=1
[ -n "$2" ] && index=$2
adb shell input tap \
$(
adb shell "uiautomator dump --compressed && cat /sdcard/window_dump.xml" \
| sed 's#<node#^<node>#g' \
| awk 'BEGIN{RS="^"}{print $0}' \
| grep "$1" \
| sed -n "$index"p \
| awk 'BEGIN{FS=",|\\[|\\]"}{print ($2+$5)/2,($3+$6)/2}'
)
}
shenyf@DESKTOP-5N7A05K MINGW64 /e
$ click 广东
shenyf@DESKTOP-5N7A05K MINGW64 /e
$ while true;do click 推荐;click 机构;done
input(){
adb shell input text 123
}
shenyf@DESKTOP-5N7A05K MINGW64 /e
swipe(){
width=$(adb shell wm size | grep -oE "[0-9]+" | head -1)
height=$(adb shell wm size | grep -oE "[0-9]+" | tail -1)
adb shell 'input swipe $(awk "BEGIN{print '$width'*'$1'}") $(awk "BEGIN{print '$height'*'$2'}") $(awk "BEGIN{print '$width'*'$3'}") $(awk "BEGIN{print '$height'*'$4'}") 1000'
}
# 向下滑动
shenyf@DESKTOP-5N7A05K MINGW64 /e
$ swipe 0.5 0.5 0.8 0.8
# 向上滑动
shenyf@DESKTOP-5N7A05K MINGW64 /e
$ swipe 0.8 0.8 0.2 0.2
Windows平台需要安装gnuplot,并配置path路径
shenyf@DESKTOP-5N7A05K MINGW64 /d/gnuplot/bin
$ for i in $(seq 20);do adb shell dumpsys meminfo com.bs.finance | grep "Dalvik Heap" | awk '{print $4}';sleep 1;done | gnuplot -e "set terminal dumb;plot '<cat' using 1 with line"
13800 +------------------------------------------------------------------+
| + + + + + + + + + |
13600 |-+ '<cat' using 1 *******-|
| * |
13400 |-+ ** +-|
| * * |
13200 |-+ * * +-|
| * * |
13000 |-+ * * +-|
| * * |
12800 |-+ * *+-|
| * * |
12600 |-+ * +-|
| * |
12400 |-+ * +-|
| * |
12200 |-+ * +-|
| * |
12000 |** * +-|
| ******************************************************* + |
11800 +------------------------------------------------------------------+
0 2 4 6 8 10 12 14 16 18 20
shenyf@DESKTOP-5N7A05K MINGW64 /d/gnuplot/bin
$
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。