T - type of underlying object.public abstract class AbstractLocatorHandler<T> extends Object implements InvocationHandler, LocatorHandler<T>
WebElement.| Modifier and Type | Field and Description |
|---|---|
protected HookChainBuilder |
hookChainBuilder |
protected List<HookDefinition<?>> |
hookDefinitions |
protected List<FluentHook> |
hooks |
protected org.openqa.selenium.support.pagefactory.ElementLocator |
locator |
protected T |
proxy |
protected T |
result |
| Constructor and Description |
|---|
AbstractLocatorHandler(org.openqa.selenium.support.pagefactory.ElementLocator locator)
Creates a new locator handler.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addListener(ProxyElementListener listener)
Add a listener for this locator handler.
|
boolean |
equals(Object obj) |
protected void |
fireProxyElementFound(T result)
Fire proxy element found event.
|
protected void |
fireProxyElementSearch()
Fire proxy element search event.
|
protected abstract org.openqa.selenium.WebElement |
getElement()
Get the underlying element.
|
org.openqa.selenium.support.pagefactory.ElementLocator |
getHookLocator()
Retrieve the element locator used by this proxy, with hooks applied.
|
protected String |
getLazyToString()
Get string representation of not already found element.
|
org.openqa.selenium.support.pagefactory.ElementLocator |
getLocator()
Retrieve the element locator used by this proxy, without any hook applied.
|
T |
getLocatorResult()
Get the actual result of the locator, if result is not defined and not stale.
|
abstract T |
getLocatorResultImpl()
Get the actual result of the locator.
|
protected static Method |
getMethod(Class<?> declaringClass,
String name,
Class... types)
Get declared method.
|
int |
hashCode() |
Object |
invoke(Object proxy,
Method method,
Object[] args) |
protected abstract boolean |
isStale()
Get the stale status of the element.
|
boolean |
loaded()
Check if this handler has loaded it's result.
|
org.openqa.selenium.NoSuchElementException |
noSuchElement()
Builds a
NoSuchElementException with a message matching this locator handler. |
void |
now()
If result is not loaded, load result immediatly.
|
boolean |
present()
Check if the result is present.
|
String |
proxyToString(String elementToString)
Get string representation of the proxy
|
boolean |
removeListener(ProxyElementListener listener)
Removes a proxy element listener.
|
void |
reset()
Reset the loaded data.
|
protected abstract List<org.openqa.selenium.WebElement> |
resultToList(T result)
Convert result to a list of selenium element.
|
void |
setHooks(HookChainBuilder hookChainBuilder,
List<HookDefinition<?>> hookDefinitions)
Apply this hook list.
|
void |
setProxy(T proxy)
Set the proxy using this handler.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInvocationTarget, getMessageContextprotected HookChainBuilder hookChainBuilder
protected List<HookDefinition<?>> hookDefinitions
protected T proxy
protected final org.openqa.selenium.support.pagefactory.ElementLocator locator
protected T result
protected List<FluentHook> hooks
public AbstractLocatorHandler(org.openqa.selenium.support.pagefactory.ElementLocator locator)
locator - selenium element locatorprotected static Method getMethod(Class<?> declaringClass, String name, Class... types)
declaringClass - declaring classname - method nametypes - argument typespublic boolean addListener(ProxyElementListener listener)
LocatorHandleraddListener in interface LocatorHandler<T>listener - listener to add, which will be notified when result is searched and foundpublic boolean removeListener(ProxyElementListener listener)
LocatorHandlerremoveListener in interface LocatorHandler<T>listener - listener to removeprotected void fireProxyElementSearch()
protected void fireProxyElementFound(T result)
result - found elementprotected abstract List<org.openqa.selenium.WebElement> resultToList(T result)
result - found resultpublic void setProxy(T proxy)
proxy - proxy using this handlerpublic abstract T getLocatorResultImpl()
public T getLocatorResult()
It also raise events.
getLocatorResult in interface LocatorHandler<T>protected abstract boolean isStale()
protected abstract org.openqa.selenium.WebElement getElement()
public org.openqa.selenium.NoSuchElementException noSuchElement()
NoSuchElementException with a message matching this locator handler.noSuchElement in interface LocatorHandler<T>public void setHooks(HookChainBuilder hookChainBuilder, List<HookDefinition<?>> hookDefinitions)
LocatorHandlersetHooks in interface LocatorHandler<T>hookChainBuilder - hook chain builderhookDefinitions - hook definitionspublic org.openqa.selenium.support.pagefactory.ElementLocator getLocator()
LocatorHandlergetLocator in interface LocatorHandler<T>public org.openqa.selenium.support.pagefactory.ElementLocator getHookLocator()
LocatorHandlergetHookLocator in interface LocatorHandler<T>public boolean loaded()
LocatorHandlerloaded in interface LocatorHandler<T>public boolean present()
LocatorHandlerpresent in interface LocatorHandler<T>public void reset()
LocatorHandlerreset in interface LocatorHandler<T>public void now()
LocatorHandlernow in interface LocatorHandler<T>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface InvocationHandlerThrowableprotected String getLazyToString()
public String proxyToString(String elementToString)
elementToString - string representation of the underlying elementCopyright © 2016 FluentLenium. All Rights Reserved.