|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openqa.selenium.support.pagefactory.DefaultElementLocator
org.openqa.selenium.support.pagefactory.AjaxElementLocator
public class AjaxElementLocator
An element locator that will wait for the specified number of seconds for an element to appear,
rather than failing instantly if it's not present. This works by polling the UI on a regular
basis. The element returned will be present on the DOM, but may not actually be visible: override
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.
| Field Summary | |
|---|---|
protected int |
timeOutInSeconds
|
| Constructor Summary | |
|---|---|
AjaxElementLocator(Clock clock,
WebDriver driver,
Field field,
int timeOutInSeconds)
|
|
AjaxElementLocator(WebDriver driver,
Field field,
int timeOutInSeconds)
Main constructor. |
|
| Method Summary | |
|---|---|
WebElement |
findElement()
Find the element. |
List<WebElement> |
findElements()
Find the element list. |
protected boolean |
isElementUsable(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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final int timeOutInSeconds
| Constructor Detail |
|---|
public AjaxElementLocator(WebDriver driver,
Field field,
int timeOutInSeconds)
driver - The WebDriver to use when locating elementsfield - The field representing this elementtimeOutInSeconds - How long to wait for the element to appear. Measured in seconds.
public AjaxElementLocator(Clock clock,
WebDriver driver,
Field field,
int timeOutInSeconds)
| Method Detail |
|---|
public WebElement findElement()
findElement in interface ElementLocatorfindElement in class DefaultElementLocatorpublic List<WebElement> findElements()
findElements in interface ElementLocatorfindElements in class DefaultElementLocatorprotected long sleepFor()
protected boolean isElementUsable(WebElement element)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||