Class DefaultElementLocator
java.lang.Object
org.openqa.selenium.support.pagefactory.DefaultElementLocator
- All Implemented Interfaces:
ElementLocator
- Direct Known Subclasses:
AjaxElementLocator
The default element locator, which will lazily locate an element or an element list on a page.
This class is designed for use with the
PageFactory
and
understands the annotations FindBy
and CacheLookup
.-
Constructor Summary
ConstructorDescriptionDefaultElementLocator
(SearchContext searchContext, Field field) Creates a new element locator.DefaultElementLocator
(SearchContext searchContext, AbstractAnnotations annotations) Use this constructor in order to process custom annotations. -
Method Summary
Modifier and TypeMethodDescriptionFind the element.Find the element list.protected boolean
Returns whether the element should be cached.toString()
-
Constructor Details
-
DefaultElementLocator
Creates a new element locator.- Parameters:
searchContext
- The context to use when finding the elementfield
- The field on the Page Object that will hold the located value
-
DefaultElementLocator
Use this constructor in order to process custom annotations.- Parameters:
searchContext
- The context to use when finding the elementannotations
- AbstractAnnotations class implementation
-
-
Method Details
-
findElement
Find the element.- Specified by:
findElement
in interfaceElementLocator
-
findElements
Find the element list.- Specified by:
findElements
in interfaceElementLocator
-
shouldCache
protected boolean shouldCache()Returns whether the element should be cached.- Returns:
true
if the element should be cached
-
toString
-