首页 > 数据库技术 > 详细

用adb命令组装PowerShell实用小工具

时间:2017-04-13 19:07:17      阅读:856      评论:0      收藏:0      [点我收藏+]

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 }}
    }
}

可以根据实际测试过程中反复手点的过程进行组装调配。比如在反复测试登录的情况下,就要反复输入密码,如果来回用手点就比较麻烦,用这个小工具的话就非常轻松了,按一下上再敲一下回车就搞定了。

技术分享

用adb命令组装PowerShell实用小工具

原文:http://www.cnblogs.com/LanTianYou/p/6705502.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!