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. Eclipse添加快速查找Dao中方法所对应的Mybatis XML映射SQL的插件

    Dao关联Mybatis快速查找的插件安装地址:http://dl.bintray.com/harawata/eclipse 安装步骤: ①Eclipse ==> Help ==> Ins ...

  2. HDU 2089 不要62(挖个坑=-=)

    不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submi ...

  3. lvs,haproxy,keepalived,heartbeat

    lvs的是通过vrrp协议进行数据包转发的,提供的是4层的负载均衡.特点是效率高,只要你机器网卡抗的住就不是问题. haproxy可以提供4层或7层的数据转发服务,能做到7层的好处是可以根据服务所处的 ...

  4. ACM2075_A/B

    #include<iostream> int main() { using namespace std; int i,j,count; cin>>count; while(co ...

  5. C#开发学习——ADO.NET几个重要对象

    ADO.NET包括多个对象模型,有Connection/Command/DataReader/DataAdapter/DataSet/DataTable/DataView等. 命名空间System.D ...

  6. winform中DataGridView的数据实现导出excel

    1,窗体设计 首先需要引入程序集:Microsoft.Office.Interop.Excel  (如果没有引用过的需要右键添加引用再搜索就行了) 实现的方法: /// <summary> ...

  7. 「S-A-L-T-A」项目失败总结!

    前言: 从2013年8月20日进入这个项目开始,到现在12月12日. 从项目详细设计开始,到现在连SI2阶段的疏通测试都没有完成! (现在,这个项目好像已经不需要我们再做下去了...) 项目失败原因总 ...

  8. IAAS云计算产品畅想-云主机的产品定位

    要研究某个产品的定位,就要先研究一下这个产品进入市场以后会影响了谁,被影响的产品产业,就是你的定位环境. 现例举一下公有云iaas服务影响了谁(按重要程度顺序): 1.企业IT 2.设备厂商 3.数据 ...

  9. wdlinux mysql innodb的安装

    mysql innodb的安装 wget -c http://down.wdlinux.cn/in/mysql_innodb_ins.sh chmod 755 mysql_innodb_ins.sh ...

  10. linux调度器系列

    http://blog.csdn.net/wudongxu/article/category/791519