美文网首页
selenium ExpectedConditions常用方法

selenium ExpectedConditions常用方法

作者: majianping | 来源:发表于2018-07-27 13:40 被阅读0次

Expected Conditions的使用场景有两种  1、直接在断言中使用  2、与WebDriverWait配合使用,动态等待页面上元素出现或者消失


1、titleIs(String title):判断当前页面的title是否精确等于预期;

2、titleContains(String title):判断当前页面的title是否包含预期字符串;

3、presenceOfElementLocated(By locator):判断某个元素是否被加到了dom树里,并不代表该元素一定可见;

4、visibilityOfElementLocated(By locator):判断某个元素是否可见(代表元素非隐藏,元素的宽和高都不等于0);

5、invisibilityOfElementLocated(By locator):判断某个元素中是否不存在于dom树或不可见;

6、textToBePresentInElement(By locator, String text):判断某个元素中的text是否包含了预期的字符串;

7、textToBePresentInElementValue(By locator, String text):判断某个元素中的value属性是否包含了预期的字符串;

8、elementToBeClickable(By locator):判断某个元素中是否可见并且是enable的,这样的话才叫clickable;

9、elementToBeSelected(By locator):判断某个元素是否被选中了,一般用在下拉列表;

10、alertIsPresent():判断页面上是否存在alert;

相关文章

  • selenium ExpectedConditions常用方法

    Expected Conditions的使用场景有两种 1、直接在断言中使用 2、与WebDriverWait配合...

  • Appium ios 隐式等待

    selenium之ExpectedConditions类以前使用eclipse感觉不是很习惯,现在使用intell...

  • Selenium2常用方法封装

    Selenium2常用方法封装

  • selenium核心技术

    一 selenium 元素定位 二 webdirver的常用属性 三 selenium webdriver方法 四...

  • selenium中 ExpectedConditions 用法说

    1、判断当前页面的title是否精确等于预期 2、判断当前页面的title是否包含预期字符串 3、判断当前页面的u...

  • Selenium的常用方法

    最近整理了一些selenium的常用方法,分享给大家 导入模块: from selenium import web...

  • selenium常用方法

    一、操作页面的方法 二、获取html文件后再进行解析(翻页) 三、多页面切换 四、定位 1、CSS定位

  • selenium常用方法

    只要坚持下去,你就发现幸运一定会发生在别人身上。 上一篇:selenium简介 浏览器操作方法 1、创建对象dri...

  • Selenium常用方法

    启动浏览器 driver =webdriver.Chrome() 打开网页 driver.get(URL) 获取当...

  • Selenium 常用方法

    1.获取当前页面的Url: 方法:current_url 实例:driver.current_url 2.获取元素...

网友评论

      本文标题:selenium ExpectedConditions常用方法

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