WebDriverWait 中 and, or, not用法
1. And 用法
wait.until(ExpectedConditions.and(
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Services")),
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Products"))
)
);
2. Or 用法
wait.until(
ExpectedConditions.or(
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Services")),
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Products"))
ExpectedConditions.visibilityOfAllElementsLocatedBy(By.name("Contact Us"))
)
);
3. Not 用法
//替换完成
webDriverWait = new WebDriverWait(browserCore, Long.valueOf(timeout)/1000);
if(expectExist){
webDriverWait.until(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
boolean flag = browserCore.getPageSource().contains(text);
if (flag) {
logger.info("Expect Text:{} present and found it ", text);
} else {
logger.error("Expect Text:{} present ,but not found it ", text);
handleFailure("Expect Text: " + text + " not present and not found it ");
}
return flag;
}
});
}else{
webDriverWait.until(ExpectedConditions.not(new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
boolean flag = browserCore.getPageSource().contains(text);
if (flag) {
logger.error("Expect Text:{} not present , but found it ", text);
handleFailure("Failed to find text: " + text);
} else {
logger.info("Expect Text:{} not present , and not found it ", text);
}
return flag;
}
}));
}
}
WebDriverWait 中 and, or, not用法的更多相关文章
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
- ecshop中foreach的详细用法归纳
ec模版中foreach的常见用法. foreach 语法: 假如后台:$smarty->assign('test',$test); {foreach from=$test item=list ...
- matlab中patch函数的用法
http://blog.sina.com.cn/s/blog_707b64550100z1nz.html matlab中patch函数的用法——emily (2011-11-18 17:20:33) ...
- C#中timer类的用法
C#中timer类的用法 关于C#中timer类 在C#里关于定时器类就有3个 1.定义在System.Windows.Forms里 2.定义在System.Threading.Timer类 ...
- C#中dynamic的正确用法
C#中dynamic的正确用法 http://www.cnblogs.com/qiuweiguo/archive/2011/08/03/2125982.html dynamic是FrameWork4 ...
- C++中typename关键字的用法
我在我的 薛途的博客 上发表了新的文章,欢迎各位批评指正. C++中typename关键字的用法
- Guava中Predicate的常见用法
Guava中Predicate的常见用法 1. Predicate基本用法 guava提供了许多利用Functions和Predicates来操作Collections的工具,一般在 Iterabl ...
- C++中const 的各种用法
C++中const 关键字的用法 const修饰变量 const 主要用于把一个对象转换成一个常量,例如: ; size = ; // error: assignment of read-only v ...
- JS里设定延时:js中SetInterval与setTimeout用法
js中SetInterval与setTimeout用法 JS里设定延时: 使用SetInterval和设定延时函数setTimeout 很类似.setTimeout 运用在延迟一段时间,再进行某项操 ...
随机推荐
- Python操作Excel_随机点菜脚本
背景: 中午快餐,菜单吃了个遍,天天纠结于不知道点啥菜. 想起读书考试时,丢纸团选答案,于是用python写个随机点菜脚本玩玩. 功能: 菜单为Excel,一个Sheet ...
- 自动化运维工具Ansible详细部署 - 人生理想在于坚持不懈 - 51CTO技术博客
自动化运维工具Ansible详细部署 - 人生理想在于坚持不懈 - 51CTO技术博客 自动化运维工具Ansible详细部署
- 【PNG格式中文详解】
技术文档(Document) PNG格式 PNG是20世纪90年代中期开始开发的图像文件存储格式,其目的是企图替代GIF和TIFF文件格式,同时增加一些GIF文件格式所不具备的特性.流式网 ...
- 通过代码来执行testng.xml
大多数时候,我们都是通过Eclipse IDE上的操作命令来执行testng 框架下的case 运行.那如果我们不想通过这种方式,而是想通过代码调用来实现执行该怎么办?下面是我搜集的两种方式供大家参考 ...
- linux —— 搭建网页项目笔记
导读 本文笔记之用,记录在我在linux下搭建与开发网站时遇到的一些碎片知识,以备将来之需. 目录 数据库相关 1.数据库相关 1) ubuntu 16.04 LTS 下mysql 的安装与使用 安 ...
- nodejs端口被占用。
I had the same issue. I ran: $ ps aux | grep node to get the process id, then: $ sudo kill -9 follow ...
- Tomcat配置多个端口号或多个应用
一.在Tomcat下配置一个应用服务(service)中,配置多个端口号. 即一个service配置多个端口,项目可以通过多个端口访问. 修改tomcat-home\conf下的server.xml, ...
- 【机房重构】SQL之视图
近期在重构机房收费系统,越往后就会越感觉到这里很多其它的是对之前学过知识(数据库,设计模式)的一种应用和回想.比方在登录功能中用到了抽象加反射,在学生下机中,我们能够用触发器来同一时候更新两个表.这里 ...
- Mate8的麒麟950怎么样? 4个问题待解决
今天下午,华为在上海发布了传闻已久的旗舰智能手机Mate 8.这款手机可以算是国产手机的佼佼者,不光在外观.功能等常规元素上达到旗舰级别,更有特色的是它采用了华为自行研发的手机SOC芯片麒麟950.目 ...
- android ScrollView 充满屏幕
android:fillViewport=true ScrollView下面的组件如果有android:layout_height="fill_parent"或android:la ...