1.默认等待30s
$driver-> wait()-> until(
WebDriverExpectedCondition :: titleIs( ' My Page '));
2.等待最多10秒,如果标题不正确,则每500ms重试一次。
$driver-> wait(10,500)-> until(
WebDriverExpectedCondition :: titleIs( ' My Page '));
3.等待条件
等待标题
titleIs()
titleContains()
titleMatches()
等待URL
urlIs()
urlContains()
urlMatches()
元素及其文字
presenceOfElementLocated()
presenceOfAllElementsLocatedBy()
elementTextIs()
elementTextContains()
elementTextMatches()
textToBePresentInElementValue()
4.常用等待条件
(1)页面元素是否在页面上可用和可被单击:elementToBeClickable
(2)页面元素处于被选中状态:elementToBeSelected
(3)页面元素在页面中存在:presenceOfElementLocated
(4)在页面元素中是否包含特定的文本:textToBePresentInElement
(5)页面元素值:textToBePresentInElementValue
(6)标题 (title):titleContains