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树中。



