Selenium: elemental wait (transfer)

Display wait, wait for the display recommended

WebDriverWait wait = new WebDriverWait(dr, 10);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("kw")));

Waiting to use explicit class comes ExpectedConditions method, determination may be made substantially to wait again. 

Explicit can customize waiting condition wait for more complex page wait condition

(1) page elements are available and can be clicked on the page: elementToBeClickable (By locator)

(2) page elements in the selected state: elementToBeSelected (WebElement element)

(3) page elements exist in the page: presenceOfElementLocated (By locator)

(4) whether a particular page elements included in the text: textToBePresentInElement (By locator)

(5) a page element values: textToBePresentInElementValue (By locator, java.lang.String text)

(6)标题 (title):titleContains(java.lang.String title)

Conditions only to explicit wait, test code will continue rearwardly subsequent test logic

If you exceed the set maximum Explicit latency threshold, this test program will throw an exception. 

WebDriverWait wait = new WebDriverWait(driver,5); 

wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(""))); 

Guess you like

Origin www.cnblogs.com/AIME/p/11982186.html