美文网首页
selenium中 ExpectedConditions 用法说

selenium中 ExpectedConditions 用法说

作者: Lydia1991 | 来源:发表于2020-07-06 15:26 被阅读0次

    1、判断当前页面的title是否精确等于预期

        titleIs( String title)
    

    2、判断当前页面的title是否包含预期字符串

        titleContains( String title)
    

    3、判断当前页面的url是否精确等于预期

      urlToBe( String url)
    

    4、判断当前页面的url是否包含预期字符串

        urlContains( String fraction)
    

    5、字符串正则表达式

     urlMatches( String regex)
    

    6、判断元素是否出现,只要有一个元素出现,就通过。举个例子,如果页面上有 n 个元素的 class 都是’column-md-3’,那么只要有 1 个元素存在,这个方法就返回 True。

        presenceOfElementLocated( By locator)
    

    7、判断元素是否出现,必须所有符合条件的元素都加载出来,才通过。

          presenceOfElementsLocated( By locator)
    

    8、如果给定元素是可见的且具有非零大小,否则为null

        elementIfVisible(WebElement element)
    

    9、判断元素是否出现

        presenceOfAllElementsLocatedBy( By locator)
    

    10、传入类型为:locator
    判断某个元素是否可见. 可见代表元素非隐藏,并且元素宽和高都不等于 0

        visibilityOfElementLocated( By locator)
    

    11、判断某组元素是否可见

        visibilityOfAllElementsLocatedBy( By locator)
    

    12、传入类型为:element
    判断某个元素是否可见. 可见代表元素非隐藏,并且元素宽和高都不等于 0

        visibilityOfAllElements(final List<WebElement> elements)
    

    13、判断某个元素中的text是否包含了预期的字符串;

        textToBePresentInElement( WebElement element,  String text)
    

    14、判断某个元素中的 text 是否 包含 了预期的字符串

        textToBePresentInElement(By locator, String text)
    

    15、判断某个元素中的 text 是否 包含 了预期的字符串

          textToBePresentInElementLocated(final By locator, final String text)
    

    16、判断某个元素中的 value 属性是否包含 了预期的字符串

       textToBePresentInElementValue( WebElement element, String text)
    

    17、判断某个元素中的 value 属性是否包含了预期的字符串

        textToBePresentInElementValue(final By locator, final String text)
    

    ……更多参见:

    https://blog.csdn.net/qq_39704682/article/details/85596644

    相关文章

      网友评论

          本文标题:selenium中 ExpectedConditions 用法说

          本文链接:https://www.haomeiwen.com/subject/oqowqktx.html