栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Selenium invisibilityOf(element)方法抛出NoSuchElementException +WebDriverWait.ignoring(NoSuchElementExce

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Selenium invisibilityOf(element)方法抛出NoSuchElementException +WebDriverWait.ignoring(NoSuchElementExce

invisibilityOf()

invisibilityOf(WebElementelement)
定义为:

public static ExpectedCondition<java.lang.Boolean> invisibilityOf(WebElement element)An expectation for checking the element to be invisible

这里的期望是,该元素必须作为前提 存在 并且 可见 ,并且该方法将等待该元素 不可见 。在这一点上,值得一提的是,由于参数的类型为
WebElement

findElement(Byby)
因此必须成功定位该元素作为前提条件。因此
NoSuchElementException
不可 忽视


invisibilityOfElementLocated()

invisibilityOfElementLocated(Bylocator)
定义为:

public static ExpectedCondition<java.lang.Boolean> invisibilityOfElementLocated(By locator)An expectation for checking that an element is either invisible or not present on the DOM.

在这里,期望显然是元素已经 不可见* 或在HTML
DOM中
不存在 。在这种情况下的主要任务是在
不存在 可偶数之前发生元件的 ExpectedCondition 在调用或在 时间跨度ExpectedCondition
是活动的。因此,在这里我们需要忽略作为一项强制措施。
*
__

NoSuchElementException


回答 问题2
:使用

wait.ignoring(org.openqa.selenium.NoSuchElementException.class);
是不合理的,因为调用的前提条件
invisibilityOf(WebElementelement)
涉及以下事实:该元素必须作为强制性措施出现在DOM树中。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/495876.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号