android UiAutomator写一个自动化工具循环造数据的例子
来源:互联网 发布:阿里云域名备案幕布 编辑:程序博客网 时间:2024/06/10 16:03
本人在学习android UiAutomator的时候,大神提到自动化可以用来造数据,根据作业功能写了一个自动提交作业的例子,顺便练习了swith-case的使用,以及自己自定义方法的运用,特别是最后两个waitForTextAndClick(),等待元素出现并点击,如果用Configurator.getInstance().setActionAcknowledgmentTimeout(50);把操作等待时间降低,就能大大提升执行的速度,现在把分享出来,如有错误还请指正。
for(int i=0;i<110;i++){// Configurator.getInstance().setActionAcknowledgmentTimeout(50);outputNotable("第"+(i+1)+"次开始!");//拍照getUiObjectByResourceId("com.dianzhi.student:id/iv").clickAndWaitForNewWindow();getUiObjectByResourceId("com.dianzhi.student:id/openCamera_dialog").clickAndWaitForNewWindow();getUiObjectByResourceId("com.oppo.camera:id/shutter_button").clickAndWaitForNewWindow();getUiObjectByResourceId("com.oppo.camera:id/btn_done").clickAndWaitForNewWindow();sleep(1000);int x = UiDevice.getInstance().getDisplayWidth();int y = UiDevice.getInstance().getDisplayHeight();clickPiont(x-180, y-90);waitForUiObject("提交");//选择年级和学科int ss = new Random().nextInt(3);switch (ss) {case 0:getUiObjectByText("高中").clickAndWaitForNewWindow();break;case 1:getUiObjectByText("初中").clickAndWaitForNewWindow();break;case 2:getUiObjectByText("小学").clickAndWaitForNewWindow();break;default:break;}int sss = new Random().nextInt(3);switch (sss) {case 0:getUiObjectByText("语文").clickAndWaitForNewWindow();break;case 1:getUiObjectByText("数学").clickAndWaitForNewWindow();break;case 2:getUiObjectByText("英语").clickAndWaitForNewWindow();break;default:break;}getUiObjectByResourceId("com.dianzhi.student:id/et").setText(Utf7ImeHelper.e("我是测试!"));getUiObjectByText("提交").clickAndWaitForNewWindow();waitForTextAndClick("知道了");UiDevice.getInstance().pressBack();waitForTextAndClick("作业辅导");}
0 0
- android UiAutomator写一个自动化工具循环造数据的例子
- android uiautomator自动化测试中写一个自定义的方法减少代码量
- Android自动化测试工具uiautomator
- android uiautomator写一个崩溃的监听
- Android自动化测试工具 UiAutomator使用详解
- android uiautomator如何写一个定时任务的方法
- android UiAutomator写一个等待对象出现的方法
- Android studio 下的Uiautomator自动化测试
- android uiautomator自动化测试
- UiAutomator android自动化测试
- Android-自动化测试UIAutomator
- Android自动化测试uiautomator
- Android UiAutoMator自动化测试
- Android Uiautomator 自动化测试
- Android Uiautomator 自动化测试
- android自动化测试工具【UiAutomator】——打开settings实例
- android自动化测试工具【UiAutomator】——打开settings实例
- android自动化测试工具【UiAutomator】——截图功能
- 删除文件提示找不到该项目
- Python数据结构
- 【位运算】找出数组中,只出现一次的两个数字
- Ubuntu安装JLink_Linux_V434a & eclipse for c/c++
- 嗡汤圆的Angular2 单页应用一些优化总结
- android UiAutomator写一个自动化工具循环造数据的例子
- 咱们一起来谈谈,redis为什么快?
- JVM性能调优监控工具jps、jstack、jmap、jhat、jstat、hprof使用详解
- 华为设备文件操作命令
- 使用visio建立数据库模型(手动和逆向自动)
- 在mybatis中处理集合、循环、数组和in查询等语句的使用
- org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect UR
- 基于物理的渲染技术(PBR)系列四
- Rxjava基本用法总结