android UiAutomator写一个等待元素出现并点击的方法
来源:互联网 发布:大学软件测试专业 编辑:程序博客网 时间:2024/06/10 02:18
写这个其实并没有特别大的意义,因为看到一篇文章得到启发,写这个方法可以省去很多代码。之前写过的一个等待控件出现的方法,后来发现api已经有了,waitforexists();,权当自己练习了。分享方法如下:
public void waitForTextAndClick(String text) throws UiObjectNotFoundException {
waitForUiObject(text);//这个是我自己写的方法,跟waitforexits源码差不多
// getUiObjectByText(text).waitForExists(10000);这个是api实现的方法
getUiObjectByText(text).clickAndWaitForNewWindow();
}
同理可以把常用的几种定位方式都写进来。
public void waitForResourceIdAndClick(String id) throws UiObjectNotFoundException {
waitForUiObject(id);
getUiObjectByText(id).clickAndWaitForNewWindow();
}
public void waitForDescAndClick(String desc) throws UiObjectNotFoundException {
waitForUiObject(desc);
getUiObjectByText(desc).clickAndWaitForNewWindow();
}
public void waitForClassNameAndClick(String name) throws UiObjectNotFoundException {
waitForUiObject(name);
getUiObjectByText(name).clickAndWaitForNewWindow();
}
不常用的,大家自己看情况吧,反正我自己都写了。
- android UiAutomator写一个等待元素出现并点击的方法
- android UiAutomator写一个等待对象出现的方法
- android uiautomator如何写一个定时任务的方法
- android uiautomator写一个崩溃的监听
- android uiautomator自动化测试中写一个自定义的方法减少代码量
- android uiautomator如何写一个带参数的方法--以画圆为例
- android UiAutomator使用递归函数写一个让屏幕一闪一闪提醒的方法
- android uiautomator一个画心形图案的方法--代码的浪漫
- android UiAutomator自定义一个判断当前版本的方法
- 在为Android 开发WebAPP 遇到的一个问题:点击元素会出现蓝框
- android uiautomator 点击分析
- android UiAutomator写一个QQ小号给大号点赞的case
- android UiAutomator写一个自动化工具循环造数据的例子
- android UiAutomator写一个给微信朋友圈所有动态点赞的用例
- android UiAutomator自己写了一个简单测试框架
- Android espresso-web等待网页元素方法
- android UiAutomator运行用例并获取运行信息的方法
- selenium2java自定义一个用js点击元素的方法
- 如何通过API调用alluxio 文件系统
- 无需Get更多技能,快速打造一个可持久化的任务调度
- 371. Sum of Two Integers
- 开源库 Natasha2016 ,让IL编程跑起来
- 旋涡JAVA笔记
- android UiAutomator写一个等待元素出现并点击的方法
- 如何在STM32F429上使用DSP库
- [LeetCode]301. Remove Invalid Parentheses
- WEB_Rember Me(自动登录) 的几种实现思路
- oracle11g OracleDBConsoleorcl服务无法启动问题
- [BZOJ2223][[Coci 2009]PATULJCI][主席树+特判]
- C-《C和指针》第五章读书笔记
- AngularJS控制器之间的数据共享及通信详解
- 25款最佳响应式前端开发框架