com.nordstrom.automation.selenium.interfaces.DetectsLoadCompletion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium3-foundation Show documentation
Show all versions of selenium3-foundation Show documentation
Selenium3 Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium 3.0 (WebDriver).
package com.nordstrom.automation.selenium.interfaces;
import org.openqa.selenium.SearchContext;
import com.nordstrom.automation.selenium.support.Coordinator;
/**
* Page classes that model pages with complex loading behavior implement this interface to provide scenario-specific
* detection of page load completion. This is typically required for single-page applications or more conventional
* multi-page applications that use dynamic load techniques (e.g. - AJAX).
*/
public interface DetectsLoadCompletion {
/**
* Determine if the page has finished loading.
*
* @return 'true' if the page has finished loading; otherwise 'false'
*/
boolean isLoadComplete();
/**
* Returns a 'wait' proxy that determines if the page has finished loading.
*
* @return 'true' if the page has finished loading; otherwise 'false'
*/
static Coordinator pageLoadIsComplete() {
return new Coordinator() {
@Override
public Boolean apply(SearchContext context) {
return Boolean.valueOf(((DetectsLoadCompletion) context).isLoadComplete());
}
@Override
public String toString() {
return "page to finish loading";
}
};
}
}