public class AjaxElementLocator extends DefaultElementLocator
isElementUsable(WebElement)
if this is important to you.
Because this class polls the interface on a regular basis, it is strongly recommended that users
avoid locating elements by XPath.Modifier and Type | Class and Description |
---|---|
private static class |
AjaxElementLocator.NoSuchElementError |
private class |
AjaxElementLocator.SlowLoadingElement |
private class |
AjaxElementLocator.SlowLoadingElementList |
Modifier and Type | Field and Description |
---|---|
private Clock |
clock |
protected int |
timeOutInSeconds |
Constructor and Description |
---|
AjaxElementLocator(Clock clock,
org.openqa.selenium.SearchContext searchContext,
java.lang.reflect.Field field,
int timeOutInSeconds) |
AjaxElementLocator(Clock clock,
org.openqa.selenium.SearchContext context,
int timeOutInSeconds,
AbstractAnnotations annotations) |
AjaxElementLocator(org.openqa.selenium.SearchContext searchContext,
java.lang.reflect.Field field,
int timeOutInSeconds)
Main constructor.
|
AjaxElementLocator(org.openqa.selenium.SearchContext context,
int timeOutInSeconds,
AbstractAnnotations annotations)
Use this constructor in order to process custom annotaions.
|
Modifier and Type | Method and Description |
---|---|
org.openqa.selenium.WebElement |
findElement()
Find the element.
|
java.util.List<org.openqa.selenium.WebElement> |
findElements()
Find the element list.
|
protected boolean |
isElementUsable(org.openqa.selenium.WebElement element)
By default, elements are considered "found" if they are in the DOM.
|
protected long |
sleepFor()
By default, we sleep for 250ms between polls.
|
toString
protected final int timeOutInSeconds
private final Clock clock
public AjaxElementLocator(org.openqa.selenium.SearchContext context, int timeOutInSeconds, AbstractAnnotations annotations)
context
- The context to use when finding the elementtimeOutInSeconds
- How long to wait for the element to appear. Measured in seconds.annotations
- AbstractAnnotations class implementationpublic AjaxElementLocator(Clock clock, org.openqa.selenium.SearchContext context, int timeOutInSeconds, AbstractAnnotations annotations)
public AjaxElementLocator(org.openqa.selenium.SearchContext searchContext, java.lang.reflect.Field field, int timeOutInSeconds)
searchContext
- The context to use when finding the elementfield
- The field representing this elementtimeOutInSeconds
- How long to wait for the element to appear. Measured in seconds.public AjaxElementLocator(Clock clock, org.openqa.selenium.SearchContext searchContext, java.lang.reflect.Field field, int timeOutInSeconds)
public org.openqa.selenium.WebElement findElement()
findElement
in interface ElementLocator
findElement
in class DefaultElementLocator
public java.util.List<org.openqa.selenium.WebElement> findElements()
findElements
in interface ElementLocator
findElements
in class DefaultElementLocator
protected long sleepFor()
protected boolean isElementUsable(org.openqa.selenium.WebElement element)
return element.isDisplayed();
element
- The element to use