Class ElementAwareWebDriverListener

java.lang.Object
io.appium.java_client.proxy.ElementAwareWebDriverListener
All Implemented Interfaces:
MethodCallListener, ProxyAwareListener

public class ElementAwareWebDriverListener extends Object implements MethodCallListener, ProxyAwareListener
  • Constructor Details

    • ElementAwareWebDriverListener

      public ElementAwareWebDriverListener()
  • Method Details

    • attachProxyInstance

      public void attachProxyInstance(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:
      attachProxyInstance in interface ProxyAwareListener
      Parameters:
      proxy - A proxy instance of WebDriver.
    • call

      public Object call(Object obj, Method method, Object[] args, Callable<?> original) throws Throwable
      Intercepts 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:
      call in interface MethodCallListener
      Parameters:
      obj - The object on which the method was invoked.
      method - The method being invoked.
      args - The arguments passed to the method.
      original - A Callable that represents the original method execution.
      Returns:
      The (possibly wrapped) result of the method call.
      Throws:
      Throwable - if the original method or any wrapping logic throws an exception.