Android Uiautomator UiDevice类
来源:互联网 发布:欧莱雅男士洗面奶知乎 编辑:程序博客网 时间:2024/05/13 16:12
获取实例:
UiDevice.getInstance().pressHome();
getUiDevice().pressHome();(通常不使用,调用函数时会出现空指针异常)
KEYCODE 键盘映射码:
1.KeyEvent 按键事件
2.META KEY
辅助功能键:ALT、SHIFT、CAPS LOCK
UiDevice.getInstance().pressKeyCode(KeyEvent.KEYCODE_A); --(a)
UiDevice.getInstance().pressKeyCode(KeyEvent.KEYCODE_A,1); --(A)
滑动与拖拽:
1步长=5ms 100步长=500ms=半秒
API:
返回值 方法名 描述
boolean drag(int startX,int startY,int endX,int endY,int steps)拖动对象从一个坐标拖动到另一个坐标
boolean swipe(Point[] segments,int segmentSteps) 在点阵列中滑动,5ms一步
boolean swipe(int startX,int startY,int endX,int endY,int steps) 通过坐标滑动屏幕
void waitForIdle(long timeout)自定义超时等待当前应用处于空闲状态
void waitForIdle()等待当前应用处于空闲状态,默认等待10s
boolean waitForWindowUpdate(String packageName,long timeout)等待窗口内容更新时间的发生
void getCurrentPackageName() 获取当前界面的包名
void dumpWindowHierarchy(String fileName)获取当前界面的布局文件,保存在/data/local/tmp目录下(xml文件)
boolean openNotification()打开通知栏
boolean openQickSettings()打开快速设置
0 0
- Android Uiautomator UiDevice类
- android自动化测试之Uiautomator-UiDevice-API
- 03Android UiAutomator UiDevice API 详细介绍
- Android自动化测试之 Uiautomator-UiDevice-API
- UiAutomator之UiDevice
- UIAutomator之---UiDevice
- Uiautomator小记之 Uidevice
- UiAutomator(2)--UiDevice API
- Android UiAutomator UiSelector类
- Android UiAutomator UiScrollable类
- Android UiAutomator UiCollection类
- uiautomator中的UiDevice学习笔记(1)
- UIautomator中的UiDevice相关的方法知识点
- uiautomator中的UiDevice学习笔记(1)
- UiAutomator笔记之UiDevice API(二)
- UIDevice类
- UIDevice 类
- android uiautomator
- 阶段性项目-双色球和酒店前台客房管理系统的实现及方法(函数)
- AssetBundle5.3.4自动打包
- iOS开发之诱导用户为自己的App评论功能
- 从今天开始写日记
- 每日任务
- Android Uiautomator UiDevice类
- [存储]Android使用SQLiteOpenHelper简单存储
- android调用webservice解析Gson数据
- 多线程-生产者消费者模式(2)
- C代码中自定义static assert实现机制
- WebService到底是什么?
- 【android学习】用TextView实现的底部菜单,以及Fragment的应用
- RabbitMQ(二)队列与消息的持久化
- Lucky Numbers (easy)(暴力解决)