标签:
private static final String JQUERY_ACTIVE_CONNECTIONS_QUERY = "return $.active == 0;";
private static ExpectedCondition<Boolean> noActiveConnections = new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
JavascriptExecutor jsExec = (JavascriptExecutor) driver;
return (Boolean) jsExec.executeScript(JQUERY_ACTIVE_CONNECTIONS_QUERY);
}
};
public static boolean waitUntilAllAjaxRequestCompletes(WebDriver driver) {
Boolean status = false;
try {
status = SeleniumUtil.createWait(driver).until(noActiveConnections);
} catch (Exception e) {
status = false;
}
return status;
}
public static boolean waitUntilAllAjaxRequestCompletes(WebDriver driver, int seconds) {
Boolean status = false;
try {
status = SeleniumUtil.createWait(driver, seconds).until(noActiveConnections);
} catch (Exception e) {
status = false;
}
return status;
}
waitUntilAllAjaxRequestCompletes
标签:
原文地址:http://www.cnblogs.com/feifeidxl/p/4551007.html