Selenium显示等待常用的等待条件ExpectedConditions


    
new WebDriverWait(Drivers._driverInstance, new TimeSpan(0, 0, 2)).Until(ExpectedConditions.InvisibilityOfElementLocated(locator));

ExpectedConditions.InvisibilityOfElementLocated(locator)等待指定元素消失
ExpectedConditions.TextToBePresentInElement 等待指定元素text出现(包含)某文字
ExpectedConditions.ElementIsVisible
ExpectedConditions.ElementExists
ExpectedConditions.titleIs
ExpectedConditions.titleContains
ExpectedConditions.UrlToBe
ExpectedConditions.UrlContains
ExpectedConditions.elementSelectionStateToBe(By.xpath("//*[@id='kw']"), true) //判断某个元素的选中状态是否符合预期

ExpectedConditions.alertIsPresent 出现alert
presenceOfAllElementsLocatedBy 检查网页上是否存在某个元素

· elementSelectionStateToBe()

· elementToBeClickable()

· elementToBeSelected()

· frameToBeAvaliableAndSwitchToIt()

· invisibilityOfTheElementLocated()

· invisibilityOfElementWithText()

· presenceOfAllElementsLocatedBy()

· presenceOfElementLocated()

· textToBePresentInElement()

· textToBePresentInElementLocated()

· textToBePresentInElementValue()

· titleIs()

· titleContains()

· visibilityOf()

· visibilityOfAllElements()

· visibilityOfAllElementsLocatedBy()

· visibilityOfElementLocated()


posted @ 2023-03-11 09:42  桃花雪  阅读(228)  评论(0编辑  收藏  举报