Package org.jboss.arquillian.graphene.proxy

Examples of org.jboss.arquillian.graphene.proxy.GrapheneProxyInstance


        }
    }

    private void registerInFrameInterceptor(Object objectToEnrich, Field field, int index, String nameOrId)
        throws IllegalAccessException, ClassNotFoundException {
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) field.get(objectToEnrich);

        if (index != -1) {
            proxy.registerInterceptor(new InFrameInterceptor(index));
        } else {
            proxy.registerInterceptor(new InFrameInterceptor(nameOrId));
        }
    }
View Full Code Here


        builder.interceptInvocation(WebDriver.class, interceptor1).findElement(Interceptors.any(By.class));
        builder.interceptInvocation(WebDriver.class, interceptor2).findElement(Interceptors.any(By.class));
        Interceptor builtInterceptor = builder.build();

        WebDriver driverProxy = GrapheneProxy.getProxyForTargetWithInterfaces(context, driver, WebDriver.class);
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) driverProxy;

        proxy.registerInterceptor(builtInterceptor);
        driverProxy.findElement(by);

        Mockito.inOrder(interceptor1, interceptor2);
        verify(interceptor1).intercept(Mockito.any(InvocationContext.class));
        verify(interceptor2).intercept(Mockito.any(InvocationContext.class));
View Full Code Here

        }
    }

    private void registerInFrameInterceptor(Object objectToEnrich, Field field, int index, String nameOrId)
        throws IllegalAccessException, ClassNotFoundException {
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) field.get(objectToEnrich);

        Class<?> fieldType = field.getType();
        if (index != -1) {
            proxy.registerInterceptor(new InFrameInterceptor(index));
        } else {
            proxy.registerInterceptor(new InFrameInterceptor(nameOrId));
        }
        if (!DO_NOT_ENRICH_FURTHER.contains(fieldType)) {
            enrichRecursivelyGrapheneProxyInstances(proxy, nameOrId, index, field);
            enrichRecursivelyGrapheneProxyInstances(proxy.unwrap(), nameOrId, index, field);
        }
    }
View Full Code Here

                    result.add(findElementLazily(context, by, searchContextFuture, i));
                }
                return result;
            }
        }), List.class);
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) elements;
        proxy.registerInterceptor(new StaleElementInterceptor());
        return elements;
    }
View Full Code Here

    protected static WebElement findElement(GrapheneContext context, final GrapheneProxy.FutureTarget target) {
        final WebElement element = GrapheneProxy.getProxyForFutureTarget(context, target, WebElement.class, Locatable.class,
                WrapsElement.class, FindsByClassName.class, FindsByCssSelector.class, FindsById.class, FindsByLinkText.class,
                FindsByName.class, FindsByTagName.class, FindsByXPath.class);
        final GrapheneProxyInstance elementProxy = (GrapheneProxyInstance) element;

        InterceptorBuilder b = new InterceptorBuilder();
        b.interceptInvocation(WrapsElement.class, new WrapsElementInterceptor(elementProxy)).getWrappedElement();

        elementProxy.registerInterceptor(b.build());
        elementProxy.registerInterceptor(new StaleElementInterceptor());
        elementProxy.registerInterceptor(new SearchContextInterceptor());
        return element;
    }
View Full Code Here

    }

    protected final WebElement createWebElement(final FutureTarget target) {
        final WebElement element = GrapheneProxy.getProxyForFutureTarget(target, WebElement.class, Locatable.class,
                WrapsElement.class);
        final GrapheneProxyInstance elementProxy = (GrapheneProxyInstance) element;

        InterceptorBuilder b = new InterceptorBuilder();
        b.interceptInvocation(WrapsElement.class, new WrapsElementInterceptor(elementProxy)).getWrappedElement();

        elementProxy.registerInterceptor(b.build());
        elementProxy.registerInterceptor(new StaleElementInterceptor());

        return element;
    }
View Full Code Here

            throw new IllegalArgumentException("The paremeter [requestExpected] is null.");
        }
        if (target == null) {
            throw new IllegalArgumentException("The paremeter [target] is null.");
        }
        GrapheneProxyInstance proxy;
        if (GrapheneProxy.isProxyInstance(target)) {
            proxy = (GrapheneProxyInstance) ((GrapheneProxyInstance) target).copy();
        } else {
            proxy = (GrapheneProxyInstance) GrapheneProxy.getProxyForTarget(target);
        }
        proxy.registerInterceptor(new Interceptor() {
            @Override
            public Object intercept(InvocationContext context) throws Throwable {

                guard.clearRequestDone();
View Full Code Here

            throw new IllegalArgumentException("The paremeter [requestExpected] is null.");
        }
        if (target == null) {
            throw new IllegalArgumentException("The paremeter [target] is null.");
        }
        GrapheneProxyInstance proxy;
        if (GrapheneProxy.isProxyInstance(target)) {
            proxy = (GrapheneProxyInstance) ((GrapheneProxyInstance) target).copy();
        } else {
            proxy = (GrapheneProxyInstance) GrapheneProxy.getProxyForTarget(context, target);
        }
        proxy.registerInterceptor(new Interceptor() {
            @Override
            public Object intercept(InvocationContext context) throws Throwable {

                guard.clearRequestDone();
View Full Code Here

        }
    }

    private void registerInFrameInterceptor(Object objectToEnrich, Field field, int index, String nameOrId)
        throws IllegalAccessException, ClassNotFoundException {
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) field.get(objectToEnrich);

        if (index != -1) {
            proxy.registerInterceptor(new InFrameInterceptor(index));
        } else {
            proxy.registerInterceptor(new InFrameInterceptor(nameOrId));
        }
    }
View Full Code Here

                    result.add(findElementLazily(context, by, searchContextFuture, i));
                }
                return result;
            }
        }), List.class);
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) elements;
        proxy.registerInterceptor(new StaleElementInterceptor());
        return elements;
    }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.graphene.proxy.GrapheneProxyInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.