PowerShell例子如下:
while($true){ Write-Host "输入数字进行选择" -ForegroundColor Green Write-Host "1 唤醒屏幕" -ForegroundColor Yellow Write-Host "2 输入文字" -ForegroundColor Yellow Write-Host "3 触发事件" -ForegroundColor Yellow Write-Host "4 向上滑动" -ForegroundColor Yellow Write-Host "5 向下滑动" -ForegroundColor Yellow Write-Host "6 向左滑动" -ForegroundColor Yellow Write-Host "7 向右滑动" -ForegroundColor Yellow Write-Host "8 删除输入" -ForegroundColor Yellow $choice = Read-Host "请选择" switch($choice) { 1{adb shell input keyevent 26} 2{$text = Read-Host "输入文字";adb shell input text $text} 3{$event = Read-Host "输入事件代号";adb shell input keyevent $event} 4{adb shell input swipe 200 800 200 100} 5{adb shell input swipe 200 100 200 800} 6{adb shell input swipe 500 100 100 100} 7{adb shell input swipe 100 100 500 100} 8{[int]$amount = Read-Host "输入要删除的字符数量";for($i=0;$i -lt $amount;$i++){ adb shell input keyevent 67 }} } }
可以根据实际测试过程中反复手点的过程进行组装调配。比如在反复测试登录的情况下,就要反复输入密码,如果来回用手点就比较麻烦,用这个小工具的话就非常轻松了,按一下上再敲一下回车就搞定了。
原文:http://www.cnblogs.com/LanTianYou/p/6705502.html