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. C++ string 构造的陷阱

    先看代码 #include<iostream> #include<string> using namespace std; int main(int argc, char ** ...

  2. UVa 10917 A Walk Through the Forest

    A Walk Through the Forest Time Limit:1000MS  Memory Limit:65536K Total Submit:48 Accepted:15 Descrip ...

  3. JavaScript高级程序设计19.pdf

    注册处理程序 navigator.registerContentHandler("applicat/rss+xml","http://www.somereader.com ...

  4. [LeetCode] Palindrome Partitioning II 解题笔记

    Given a string s, partition s such that every substring of the partition is a palindrome. Return the ...

  5. 【转】CPU调度

    转自:http://blog.csdn.net/xiazdong/article/details/6280345 CPU调度   用于多道程序 以下先讨论对于单CPU的调度问题. 回顾多道程序,同时把 ...

  6. c#委托和事件(上)

    C# 中的委托和事件 引言 委托 和 事件在 .Net Framework中的应用非常广泛,然而,较好地理解委托和事件对很多接触C#时间不长的人来说并不容易.它们就像是一道槛儿,过了这个槛的人,觉得真 ...

  7. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(39)-在线人数统计探讨

    原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(39)-在线人数统计探讨 系列目录 基于web的网站在线统计一直处于不是很精准的状态!基本上没有一种方法可 ...

  8. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(20)-权限管理系统-根据权限获取菜单

    原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(20)-权限管理系统-根据权限获取菜单 不知不觉到20讲,真是漫长的日子,可惜最近工作挺忙,要不可以有更多 ...

  9. Newtonsoft.Json 与 DataTable的相互转换

    1.这里下载:http://www.newtonsoft.com/products/json/ 安装:    解压下载文件,得到Newtonsoft.Json.dll    在项目中添加引用 2.引入 ...

  10. Delphi ListView基本用法大全

    //增加项或列(字段) ListView1.Clear; ListView1.Columns.Clear; ListView1.Columns.Add; ListView1.Columns.Add; ...