public static WebElement unwrap(WebElement element) { Preconditions.checkNotNull(element, "The element cannot be null."); WebElement result = element; while (GrapheneProxy.isProxyInstance(result)) { result = ((GrapheneProxyInstance) result).unwrap(); } return result; }
private static <T> T requestTimeWaiting(T target, Interceptor interceptor) { GrapheneProxyInstance proxy; if (GrapheneProxy.isProxyInstance(target)) { proxy = (GrapheneProxyInstance) ((GrapheneProxyInstance) target).copy(); } else { throw new IllegalStateException("Can't create a new proxy."); } proxy.registerInterceptor(interceptor); return (T) proxy; }