@Override public Object[] getArguments() { return arguments == null ? following.getArguments(): arguments; }
@Override public Object[] getArguments() { return arguments == null ? following.getArguments(): arguments; }
@Override public Object intercept(InvocationContext context) throws Throwable { if (context.getMethod().getName().equals(GET_METHOD_NAME)) { tryToLoadPage((WebDriver) context.getTarget(), String.valueOf(context.getArguments()[0])); return null;// skip any other interceptors } else { return context.invoke();// invoke method normally } }
@Override public Object intercept(final InvocationContext context) throws Throwable { GrapheneProxy.FutureTarget future = new GrapheneProxy.FutureTarget() { @Override public Object getTarget() { return context.getProxy(); } }; if (methodsEqual(context.getMethod(), SearchContext.class.getDeclaredMethod("findElement", By.class))) { return WebElementUtils.findElement(context.getGrapheneContext(), (By) context.getArguments()[0], future); } else if (methodsEqual(context.getMethod(), SearchContext.class.getDeclaredMethod("findElements", By.class))) { return WebElementUtils.findElementsLazily(context.getGrapheneContext(), (By) context.getArguments()[0], future); } else { return context.invoke(); } }
@Override public Object intercept(final InvocationContext context) throws Throwable { GrapheneProxy.FutureTarget future = new GrapheneProxy.FutureTarget() { @Override public Object getTarget() { return context.getProxy(); } }; if (methodsEqual(context.getMethod(), SearchContext.class.getDeclaredMethod("findElement", By.class))) { return WebElementUtils.findElement(context.getGrapheneContext(), (By) context.getArguments()[0], future); } else if (methodsEqual(context.getMethod(), SearchContext.class.getDeclaredMethod("findElements", By.class))) { return WebElementUtils.findElementsLazily(context.getGrapheneContext(), (By) context.getArguments()[0], future); } else { return context.invoke(); } }