Package org.jboss.arquillian.graphene.page

Examples of org.jboss.arquillian.graphene.page.Location


        handleLocationOf(pageObject, browser);
        return result;
    }

    private void handleLocationOf(Class<?> pageObjectClass, WebDriver browser) {
        Location location = pageObjectClass.getAnnotation(Location.class);
        if (location == null) {
            throw new IllegalArgumentException(String.format("The page object '%s' that you are navigating to "
                + "using either Graphene.goTo(<page_object>) or @InitialPage is not annotated with @Location",
                pageObjectClass.getSimpleName()));
        }

        if (location.scheme() == null) {
            throw new IllegalArgumentException("Scheme for provided @Location can not be a null object.");
        }

        Class<?> schemeClass = null;

        String defaultSchemeString = configuration.get().getScheme();

        try {
            if (defaultSchemeString != null) {
                schemeClass = SecurityActions.newInstance(defaultSchemeString);
            }
        } catch (IllegalArgumentException ex) {
        }

        if (schemeClass == null) {
            schemeClass = location.scheme();
        }

        injector.get().inject(locationStore.get());

        LocationDecider decider = resolveDecider(serviceLoader.get().all(LocationDecider.class), schemeClass);

        if (decider == null) {
            throw new UnsupportedOperationException(String.format("There is not any registered location decider "
                + "which can decide '%s' scheme.", location.scheme().toString()));
        }

        browser.get(decider.decide(location.value()));
    }
View Full Code Here


        return result;
    }

    private void handleLocationOf(Class<?> pageObjectClass, WebDriver browser) {

        Location location = pageObjectClass.getAnnotation(Location.class);
        if (location == null) {
            throw new IllegalArgumentException(
                String
                    .format(
                        "The page object '%s' that you are navigating to using either Graphene.goTo(<page_object>) or @InitialPage isn't annotated with @Location",
                        pageObjectClass.getSimpleName()));
        }

        try {
            URL url = getURLFromLocation(location);
            browser.get(url.toExternalForm());
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException(String.format("Location '%s' specified on %s is not valid URL",
                location.value(), pageObjectClass.getSimpleName()));
        }
    }
View Full Code Here

        handleLocationOf(pageObject, browser);
        return result;
    }

    private void handleLocationOf(Class<?> pageObjectClass, WebDriver browser) {
        Location location = pageObjectClass.getAnnotation(Location.class);
        if (location == null) {
            throw new IllegalArgumentException(
                String
                    .format(
                        "The page object '%s' that you are navigating to using either Graphene.goTo(<page_object>) or @InitialPage isn't annotated with @Location",
                        pageObjectClass.getSimpleName()));
        }

        try {
            URL url = getURLFromLocation(location);
            browser.get(url.toExternalForm());
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException(String.format("Location '%s' specified on %s is not valid URL",
                location.value(), pageObjectClass.getSimpleName()));
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.graphene.page.Location

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.