T - type of underlying object.public abstract class AbstractLocatorHandler<T> extends java.lang.Object implements java.lang.reflect.InvocationHandler, LocatorHandler<T>
WebElement.| Modifier and Type | Field and Description |
|---|---|
protected HookChainBuilder |
hookChainBuilder |
protected java.util.List<HookDefinition<?>> |
hookDefinitions |
protected java.util.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(java.lang.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 java.lang.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 java.lang.reflect.Method |
getMethod(java.lang.Class<?> declaringClass,
java.lang.String name,
java.lang.Class... types)
Get declared method.
|
int |
hashCode() |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.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 immediately.
|
boolean |
present()
Check if the result is present.
|
java.lang.String |
proxyToString(java.lang.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 java.util.List<org.openqa.selenium.WebElement> |
resultToList(T result)
Convert result to a list of selenium element.
|
void |
setHooks(HookChainBuilder hookChainBuilder,
java.util.List<HookDefinition<?>> hookDefinitions)
Apply this hook list.
|
void |
setProxy(T proxy)
Set the proxy using this handler.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInvocationTarget, getMessageContextprotected HookChainBuilder hookChainBuilder
protected java.util.List<HookDefinition<?>> hookDefinitions
protected T proxy
protected final org.openqa.selenium.support.pagefactory.ElementLocator locator
protected T result
protected java.util.List<FluentHook> hooks
public AbstractLocatorHandler(org.openqa.selenium.support.pagefactory.ElementLocator locator)
locator - selenium element locatorprotected static java.lang.reflect.Method getMethod(java.lang.Class<?> declaringClass,
java.lang.String name,
java.lang.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 java.util.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, java.util.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 java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
invoke in interface java.lang.reflect.InvocationHandlerjava.lang.Throwablepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectprotected java.lang.String getLazyToString()
public java.lang.String proxyToString(java.lang.String elementToString)
elementToString - string representation of the underlying elementpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018 FluentLenium. All Rights Reserved.