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 用法

    public void expectTextExistOrNot(final boolean expectExist, final String text, int timeout) {
        //替换完成
        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用法的更多相关文章

  1. Java中的Socket的用法

                                   Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...

  2. ecshop中foreach的详细用法归纳

    ec模版中foreach的常见用法. foreach 语法: 假如后台:$smarty->assign('test',$test); {foreach from=$test item=list ...

  3. matlab中patch函数的用法

    http://blog.sina.com.cn/s/blog_707b64550100z1nz.html matlab中patch函数的用法——emily (2011-11-18 17:20:33) ...

  4. C#中timer类的用法

    C#中timer类的用法 关于C#中timer类  在C#里关于定时器类就有3个   1.定义在System.Windows.Forms里   2.定义在System.Threading.Timer类 ...

  5. C#中dynamic的正确用法

    C#中dynamic的正确用法  http://www.cnblogs.com/qiuweiguo/archive/2011/08/03/2125982.html dynamic是FrameWork4 ...

  6. C++中typename关键字的用法

    我在我的 薛途的博客 上发表了新的文章,欢迎各位批评指正. C++中typename关键字的用法

  7. Guava中Predicate的常见用法

    Guava中Predicate的常见用法 1.  Predicate基本用法 guava提供了许多利用Functions和Predicates来操作Collections的工具,一般在 Iterabl ...

  8. C++中const 的各种用法

    C++中const 关键字的用法 const修饰变量 const 主要用于把一个对象转换成一个常量,例如: ; size = ; // error: assignment of read-only v ...

  9. JS里设定延时:js中SetInterval与setTimeout用法

     js中SetInterval与setTimeout用法 JS里设定延时: 使用SetInterval和设定延时函数setTimeout 很类似.setTimeout 运用在延迟一段时间,再进行某项操 ...

随机推荐

  1. linux apache模块的安装

    最近,想使用apache的mod_status来查看一下apache的服务器状态,就自己安装了一下mod_status,以前觉得好像很难的东西其实很简单. 第一步, 去http://httpd.apa ...

  2. Linux学习笔记22——线程属性(转)

    本文来自博客园:http://www.cnblogs.com/yc_sunniwell/archive/2010/06/24/1764204.html 一.线程属性线程具有属性,用pthread_at ...

  3. 如何使用TcpDump抓取远程主机的流量并回显到本地的WireShark上

    ssh -t username@remoteip "echo rootpassword | sudo -S tcpdump -i eth0 -A '(tcp[((tcp[12:1] & ...

  4. 【PNG格式中文详解】

        技术文档(Document)   PNG格式 PNG是20世纪90年代中期开始开发的图像文件存储格式,其目的是企图替代GIF和TIFF文件格式,同时增加一些GIF文件格式所不具备的特性.流式网 ...

  5. cocoaPods教程

    <#这个不是命令,包括尖括号#> 一.源设置 1. 查看源,终端输入:  sudo gem sources -l 2. 删除已有的源,如:  sudo gem sources --remo ...

  6. Servlet实现表单提交(MyEclipse10,Tomcat7.0,JDK1.7,)——Java Web练习(一)

    1.MyEclipse|File|New|Project|Web Project    填写Project Name:exServlet,点选Java EE 6.0(配套Tomcat7.0) 2.代码 ...

  7. python_list和tuple互转

    Python中,tuple和list均为内置类型, 以list作为参数将tuple类初始化,将返回tuple类型 tuple([1,2,3,4]) list->tuple 以tuple做为参数, ...

  8. mysql in查询 结果乱序 引发的思考

    Mysql in查询 结果集 乱序 SQL: select * from table where id IN (3,6,9,1,2,5,8,7); 这样的情况取出来后,其实,id还是按1,2,3,4, ...

  9. 基于TCP的socket通信过程及例子

    Socket也叫套接字,用来实现网络通讯,通过调用系统提供的API,可以和远程的机子传输数据.Socket有很多种协议,而这篇文章主要讨论TCP部分的内容,也就是说后面说的内容主要是指TCP Sock ...

  10. eclipse编辑器,怎么创建PHP和JAVA的工程项目?

    eclipse编辑器,怎么创建PHP和JAVA的工程项目.强大的eclipse,编写php或者java由你选择!!! 我为什么这么说? 我是新手,写下这篇文章,可能对新手会有一点点的帮助而已,然后为了 ...