我想了解如何使用lambda替换常见的WebDriverWait
。
WebDriverWait
用于显式等待某些事件发生。
代码示例:
(new WebDriverWait(Driver.driver.get(), 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.findElement(By.id("DataTables_Table_0_processing")).isDisplayed();
}
});
或者:
(new WebDriverWait(Driver.driver.get(), 10))
.until(ExpectedConditions
.invisibilityOfElementLocated(By.id("DataTables_Table_0_processing")));
如何使用Lambda表达式替换它?