Package io.appium.java_client.proxy
Class ElementAwareWebDriverListener
- java.lang.Object
-
- io.appium.java_client.proxy.ElementAwareWebDriverListener
-
- All Implemented Interfaces:
MethodCallListener,ProxyAwareListener
public class ElementAwareWebDriverListener extends java.lang.Object implements MethodCallListener, ProxyAwareListener
-
-
Field Summary
-
Fields inherited from interface io.appium.java_client.proxy.MethodCallListener
UNSET
-
-
Constructor Summary
Constructors Constructor Description ElementAwareWebDriverListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachProxyInstance(java.lang.Object proxy)Attaches the WebDriver proxy instance to this listener.java.lang.Objectcall(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.util.concurrent.Callable<?> original)Intercepts method calls on a proxied WebDriver.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.appium.java_client.proxy.MethodCallListener
afterCall, beforeCall, onError
-
-
-
-
Method Detail
-
attachProxyInstance
public void attachProxyInstance(java.lang.Object proxy)
Attaches the WebDriver proxy instance to this listener.The listener stores the WebDriver instance to associate it as parent to RemoteWebElement proxies.
- Specified by:
attachProxyInstancein interfaceProxyAwareListener- Parameters:
proxy- A proxy instance ofWebDriver.
-
call
public java.lang.Object call(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, java.util.concurrent.Callable<?> original) throws java.lang.ThrowableIntercepts method calls on a proxied WebDriver.If the result of the method call is a
RemoteWebElement, it is wrapped with a proxy to allow further interception of RemoteWebElement method calls. If the result is a list, each item is checked, and all RemoteWebElements are individually proxied. All other return types are passed through unmodified. Avoid overriding this method, it will alter the behaviour of the listener.- Specified by:
callin interfaceMethodCallListener- Parameters:
obj- The object on which the method was invoked.method- The method being invoked.args- The arguments passed to the method.original- ACallablethat represents the original method execution.- Returns:
- The (possibly wrapped) result of the method call.
- Throws:
java.lang.Throwable- if the original method or any wrapping logic throws an exception.
-
-