Android espresso-web等待网页元素方法
来源:互联网 发布:印度it为何这么强 知乎 编辑:程序博客网 时间:2024/06/05 21:06
//方法中只允许传xpath,只要稍作修改就可以以其他的定位方式来操作
public static boolean waitForWebView(String xpath) {
long endtime_2 = SystemClock.uptimeMillis() + 10000;
do {
try {
Web.onWebView().forceJavascriptEnabled();
Web.onWebView().withElement(DriverAtoms.findElement(Locator.XPATH, xpath));
return true;
} catch (Throwable e) {
if (!e.getMessage().equals("java.lang.RuntimeException: Atom evaluation returned null!")) {
throw new RuntimeException("Util.waitForWebView()抛出异常:" + e.getMessage());
}
}
if (SystemClock.uptimeMillis() > endtime_2) {
return false;
}
} while (true);
}
public static boolean waitForWebView(String xpath) {
long endtime_2 = SystemClock.uptimeMillis() + 10000;
do {
try {
Web.onWebView().forceJavascriptEnabled();
Web.onWebView().withElement(DriverAtoms.findElement(Locator.XPATH, xpath));
return true;
} catch (Throwable e) {
if (!e.getMessage().equals("java.lang.RuntimeException: Atom evaluation returned null!")) {
throw new RuntimeException("Util.waitForWebView()抛出异常:" + e.getMessage());
}
}
if (SystemClock.uptimeMillis() > endtime_2) {
return false;
}
} while (true);
}
阅读全文
0 0
- Android espresso-web等待网页元素方法
- android espresso
- Espresso 常用方法简介
- webdriver页面元素等待问题处理方法
- Selenium等待元素的处理方法
- webdriver页面元素等待问题处理方法
- appium三种等待元素的方法
- appium三种等待元素的方法
- Selenium:元素等待的4种方法
- android UiAutomator写一个等待元素出现并点击的方法
- Android测试 ---- Espresso + Jacoco
- Android Espresso单元测试
- Introduction to Android Espresso
- Android Espresso Test UI
- Android Espresso浅谈
- Android Espresso UI测试
- Android单元测试框架-Espresso
- Android Espresso单元测试
- 点击率预测算法:FTRL
- Vue.js和MVVM小细节
- 有兴趣的进来
- 将微信公众号的文章保存到本地pdf
- 阿里云创建E-MapReduce 1 快速开始
- Android espresso-web等待网页元素方法
- cat /proc/net/dev 查询网口状况
- 关于spring在controller层的事务操作
- python中的join和split
- hud 1874畅通工程续(6种写法,复习各种最短路)
- 再搞SQLServer添加Oracle链接服务器
- C#Winform调用libEasyPlayer总结
- Linux CentOS 6.6安装JDK1.7
- eclipse导入项目,项目名出现红叉的情况