Package org.jboss.arquillian.graphene.enricher.exception

Examples of org.jboss.arquillian.graphene.enricher.exception.GrapheneTestEnricherException


            checkInFrameParameters(field, index, nameOrId);

            try {
                registerInFrameInterceptor(objectToEnrich, field, index, nameOrId);
            } catch (IllegalArgumentException e) {
                throw new GrapheneTestEnricherException(
                    "Only org.openqa.selenium.WebElement, Page fragments fields and Page Object fields can be annotated with @InFrame. Check the field: "
                        + field + " declared in the class: " + objectToEnrich.getClass(), e);
            } catch (Exception e) {
                throw new GrapheneTestEnricherException(e);
            }
            if (!isAccessible) {
                field.setAccessible(false);
            }
        }
View Full Code Here


        }
    }

    private void checkInFrameParameters(Field field, int index, String nameOrId) {
        if ((nameOrId.trim().equals("") && index < 0)) {
            throw new GrapheneTestEnricherException(
                "You have to provide either non empty nameOrId or non negative index value of the frame/iframe in the @InFrame. Check field "
                    + field + " declared in: " + field.getDeclaringClass());
        }
    }
View Full Code Here

            field.setAccessible(true);
        }
        try {
            field.set(target, value);
        } catch (Exception ex) {
            throw new GrapheneTestEnricherException("During enriching of " + NEW_LINE + target.getClass() + NEW_LINE
                + " the field " + NEW_LINE + field + " was not able to be set! Check the cause!", ex);
        }
        if (!accessible) {
            field.setAccessible(false);
        }
View Full Code Here

        GrapheneContext grapheneContext = GrapheneContext.getContextFor(browserQualifier);
        WebDriver browser = grapheneContext.getWebDriver();
        try {
            result = PageObjectEnricher.setupPage(grapheneContext, browser, pageObject);
        } catch (Exception e) {
            throw new GrapheneTestEnricherException("Error while initializing: " + pageObject, e);
        }
        handleLocationOf(pageObject, browser);
        return result;
    }
View Full Code Here

            checkInFrameParameters(field, index, nameOrId);

            try {
                registerInFrameInterceptor(objectToEnrich, field, index, nameOrId);
            } catch (IllegalArgumentException e) {
                throw new GrapheneTestEnricherException(
                    "Only org.openqa.selenium.WebElement, Page fragments fields and Page Object fields can be annotated with @InFrame. Check the field: "
                        + field + " declared in the class: " + objectToEnrich.getClass(), e);
            } catch (Exception e) {
                throw new GrapheneTestEnricherException(e);
            }
            if (!isAccessible) {
                field.setAccessible(false);
            }
        }
View Full Code Here

        }
    }

    private void checkInFrameParameters(Field field, int index, String nameOrId) {
        if ((nameOrId.trim().equals("") && index < 0)) {
            throw new GrapheneTestEnricherException(
                "You have to provide either non empty nameOrId or non negative index value of the frame/iframe in the @InFrame. Check field "
                    + field + " declared in: " + field.getDeclaringClass());
        }
    }
View Full Code Here

                    final By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
                    Object wrapper;
                    try {
                        wrapper = createWrapper(grapheneContext, field.getType(), WebElementUtils.findElementLazily(rootBy, localSearchContext));
                    } catch (Exception e) {
                        throw new GrapheneTestEnricherException("Can't instantiate element wrapper " + target.getClass() + "." + field.getName() + " of type " + field.getType(), e);
                    }
                    try {
                        setValue(field, target, wrapper);
                    } catch (Exception e) {
                        throw new GrapheneTestEnricherException("Can't set a value to the " + target.getClass() + "." + field.getName() + ".", e);
                    }
                } else if (field.getType().isAssignableFrom(List.class)
                        && isValidClass(getListType(field))) {
                    final SearchContext localSearchContext;
                    GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext).getContext();
                    if (grapheneContext == null) {
                        grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations()));
                        localSearchContext = grapheneContext.getWebDriver(SearchContext.class);
                    } else {
                        localSearchContext = searchContext;
                    }
                    final By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
                    try {
                        Class<?> type = getListType(field);
                        Object wrappers = createWrappers(grapheneContext, type, WebElementUtils.findElementsLazily(rootBy, localSearchContext));
                        setValue(field, target, wrappers);
                    } catch (Exception e) {
                        throw new GrapheneTestEnricherException("Can't set a value to the " + target.getClass() + "." + field.getName() + ".", e);
                    }
                }
            } catch (ClassNotFoundException e) {
                throw new IllegalStateException(e.getMessage(), e);
            }
View Full Code Here

            field.setAccessible(true);
        }
        try {
            field.set(target, value);
        } catch (Exception ex) {
            throw new GrapheneTestEnricherException("During enriching of " + NEW_LINE + target.getClass() + NEW_LINE
                + " the field " + NEW_LINE + field + " was not able to be set! Check the cause!", ex);
        }
        if (!accessible) {
            field.setAccessible(false);
        }
View Full Code Here

        GrapheneContext grapheneContext = GrapheneContext.getContextFor(browserQualifier);
        WebDriver browser = grapheneContext.getWebDriver();
        try {
            result = PageObjectEnricher.setupPage(grapheneContext, browser, pageObject);
        } catch (Exception e) {
            throw new GrapheneTestEnricherException("Error while initializing: " + pageObject, e);
        }
        handleLocationOf(pageObject, browser);
        return result;
    }
View Full Code Here

                    + " is annotated with empty @FindBy annotation, in other words it "
                    + "should contain parameter which will define the strategy for referencing that element.";
                // WebElement
                if (field.getType().isAssignableFrom(WebElement.class)) {
                    if (by == null) {
                        throw new GrapheneTestEnricherException(message);
                    }
                    WebElement element = createWebElement(by, searchContext);
                    setValue(field, target, element);
                    // List<WebElement>
                } else if (field.getType().isAssignableFrom(List.class)
                    && getListType(field).isAssignableFrom(WebElement.class)) {
                    if (by == null) {
                        throw new GrapheneTestEnricherException(message);
                    }
                    List<WebElement> elements = createWebElements(by, searchContext);
                    setValue(field, target, elements);
                }
            }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.graphene.enricher.exception.GrapheneTestEnricherException

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.