Android adb shell input 命令详解

​最近再玩一个动物餐厅小游戏时,需要频繁点击手机,点击电台宣传来获得客户,后来想到是不是可以用脚本实现,自动点击呢,就想到了用adb 的input 命令,然后写成bat批处理执行。首先看下input有哪些用法,如下图:

text:输入字符串

   例如: adb shell input text "123"     当前的焦点空间输入123

keyevent:输入键盘事件

   例如:adb shell input keyevent "KEYCODE_POWER"  模拟点击电源按钮

tap: 点击指定位置,指定x,y坐标

    例如:adb shell input tap 100 100    点击屏幕(100,100)的位置

  屏幕的位置坐标可以在开发者选项中打开查看轨迹功能查看

swipe:滑动位置,模拟滑动手机,输入起点坐标(x,y),终点坐标(X1,Y1),以及滑动时间

    例如:adb shell input swipe 100 100 200 200 300,从(100,100)滑动到(200,200),执行时间300毫秒

        adb shell input swipe 100 100 100 100 300   长按300毫秒

 

rem 动物餐厅小程序点击宣传单代码:abcfor /l %%i in (1,1,20) do ( rem 点击电台宣传    adb shell input tap 1000 1750  )  rem 点击第一桌的点菜  adb shell input tap 406 708  rem 点击第二桌的点菜  adb shell input tap 652 720  rem 点击第三桌的点菜  adb shell input tap 888 721  rem 点击第四桌的点菜  adb shell input tap 419 1028  rem 点击第五桌的点菜  adb shell input tap 658 1040  rem 点击第六桌的点菜  adb shell input tap 900 1050 goto abc

更多软件测试相关知识关注公众号:软件测试道与术

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值