栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

常用Android脚本汇总

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

常用Android脚本汇总

Android的常用输入命令中,使用如下脚本命令,可以完成一些自动化测试

    输入文本:
    adb shell input text 12345
    输入12345文本

    功能键:
    adb shell input keyevent 4 返回
    adb shell input keyevent 66 确定
    adb shell input keyevent 67 删除;更多的keyevent键对应code值参考 http://www.cnblogs.com/chengchengla1990/p/4515108.html

    点击:
    adb shell input tap 20 1000
    点击位置(20,1000)

    滑动(长按)
    adb shell input swipe 10 20 100 200
    从(10,20)滑动到(100,200)
    长按的技巧
    最后加一个参数,表示操作的时间ms,如
    adb shell input swipe 100 200 500 600 900 从(100,200)滑动到(500,600)总花费900ms
    adb shell input swipe 1400 400 1400 400 900 长按(1400,400) 900ms

延时方法:
for /l %%i in (1,1,1000) do echo %%i>nul
其中1000表示1000ms,精度不是很高,最高能达到100ms左右

一个抖音自动滑动的脚本 test.bat

@echo off

adb devices

:loop

adb devices

ping 1.1.1.1 -n 1 -w 5000 > nul

adb shell input swipe 800 1800 800 1200

goto loop
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/727281.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号