net.thucydides.core.annotations.locators
Class SmartAjaxElementLocator

Package class diagram package SmartAjaxElementLocator
java.lang.Object
  extended by net.thucydides.core.annotations.locators.SmartElementLocator
      extended by net.thucydides.core.annotations.locators.SmartAjaxElementLocator
All Implemented Interfaces:
org.openqa.selenium.support.pagefactory.ElementLocator

public class SmartAjaxElementLocator
extends SmartElementLocator


Field Summary
protected  int timeOutInSeconds
           
 
Constructor Summary
SmartAjaxElementLocator(org.openqa.selenium.support.ui.Clock clock, org.openqa.selenium.WebDriver driver, Field field, int timeOutInSeconds)
           
SmartAjaxElementLocator(org.openqa.selenium.WebDriver driver, Field field, int timeOutInSeconds)
          Main constructor.
 
Method Summary
 org.openqa.selenium.WebElement ajaxFindElement()
           Will poll the interface on a regular basis until the element is present.
 org.openqa.selenium.WebElement findElement()
          Find the element.
 org.openqa.selenium.WebElement findElementImmediately()
           
 List<org.openqa.selenium.WebElement> findElements()
          Find the element list.
protected  boolean isElementUsable(org.openqa.selenium.WebElement element)
           
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

timeOutInSeconds

protected final int timeOutInSeconds
Constructor Detail

SmartAjaxElementLocator

public SmartAjaxElementLocator(org.openqa.selenium.WebDriver driver,
                               Field field,
                               int timeOutInSeconds)
Main constructor.

Parameters:
driver - The WebDriver to use when locating elements
field - The field representing this element
timeOutInSeconds - How long to wait for the element to appear. Measured in seconds.

SmartAjaxElementLocator

public SmartAjaxElementLocator(org.openqa.selenium.support.ui.Clock clock,
                               org.openqa.selenium.WebDriver driver,
                               Field field,
                               int timeOutInSeconds)
Method Detail

findElement

public org.openqa.selenium.WebElement findElement()
Description copied from class: SmartElementLocator
Find the element.

Specified by:
findElement in interface org.openqa.selenium.support.pagefactory.ElementLocator
Overrides:
findElement in class SmartElementLocator

findElementImmediately

public org.openqa.selenium.WebElement findElementImmediately()

isElementUsable

protected boolean isElementUsable(org.openqa.selenium.WebElement element)

ajaxFindElement

public org.openqa.selenium.WebElement ajaxFindElement()
Will poll the interface on a regular basis until the element is present.


findElements

public List<org.openqa.selenium.WebElement> findElements()
Find the element list. Will poll the interface on a regular basis until at least one element is present.

Specified by:
findElements in interface org.openqa.selenium.support.pagefactory.ElementLocator
Overrides:
findElements in class SmartElementLocator

sleepFor

protected long sleepFor()
By default, we sleep for 250ms between polls. You may override this method in order to change how it sleeps.

Returns:
Duration to sleep in milliseconds


Copyright © 2011-2013 Wakaleo Consulting. All Rights Reserved.