Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlSubmitInput


        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("cumulus.jsf"));
        assert !isLongRunning(page);

        // try ending a transient conversation
        HtmlSubmitInput endConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class,
                "endConversationAndSwallowException");
        page = endConversationButton.click();
        assert page.getBody().getTextContent().contains("Hello world!");
    }
View Full Code Here


        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("cumulus.jsf"));
        assert !isLongRunning(page);

        // begin a conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class,
                "beginConversationIdentifiedByCustomIdentifier");
        page = beginConversationButton.click();
        assert isLongRunning(page);
        assert getCid(page).equals("humilis");
        assert page.getBody().getTextContent().contains("Cumulus humilis");
    }
View Full Code Here

        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("cumulus.jsf"));
        assert !isLongRunning(page);

        // begin a conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class,
                "beginConversationButton");
        page = beginConversationButton.click();
        assert isLongRunning(page);
        assert getCid(page) != null;
        assert page.getBody().getTextContent().contains("Cumulus congestus");
    }
View Full Code Here

        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("cumulus.jsf"));
        assert !isLongRunning(page);

        // begin a conversation and set a custom timeout
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class,
                "beginConversationAndSetTimeout");
        page = beginConversationButton.click();
        assert page.getBody().getTextContent().contains("Cumulonimbus");
    }
View Full Code Here

        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("cumulus.jsf"));
        assert !isLongRunning(page);

        // begin a conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(page, HtmlSubmitInput.class,
                "beginConversationButton");
        page = beginConversationButton.click();
        assert page.getBody().getTextContent().contains("Stratocumulus");
    }
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertions({ @SpecAssertion(section = "6.7.4", id = "l"), @SpecAssertion(section = "2.4.1", id = "ba") })
    public void testConversationPropagated() throws Exception {
        WebClient webClient = new WebClient();
        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(STORM_STRENGTH);
        String stormCid = getCid(storm);
        HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
        HtmlPage thunder = thunderButton.click();
        assert stormCid.equals(getCid(thunder));
        stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
        assert stormStrength.getValueAttribute().equals(STORM_STRENGTH);
    }
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertion(section = "6.7.4", id = "m")
    public void testConversationPropagatedOverRedirect() throws Exception {
        WebClient webClient = new WebClient();
        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(REDIRECT_STORM_STRENGTH);
        String stormCid = getCid(storm);
        HtmlSubmitInput lighteningButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "lighteningButton");
        HtmlPage lightening = lighteningButton.click();
        assert lightening.getWebResponse().getRequestUrl().toString().contains("lightening.jsf");
        assert stormCid.equals(getCid(lightening));
        stormStrength = getFirstMatchingElement(lightening, HtmlTextInput.class, "stormStrength");
        assert stormStrength.getValueAttribute().equals(REDIRECT_STORM_STRENGTH);
    }
View Full Code Here

            final HtmlForm loginForm = authPage.getFormByName("oauth2SAuthorizeForm");
            final HtmlTextInput login = loginForm.getInputByName("session_key");
            login.setText(oAuthParams.getUserName());
            final HtmlPasswordInput password = loginForm.getInputByName("session_password");
            password.setText(oAuthParams.getUserPassword());
            final HtmlSubmitInput submitInput = loginForm.getInputByName("authorize");

            // disable redirect to avoid loading redirect URL
            webClient.getOptions().setRedirectEnabled(false);

            // validate CSRF and get authorization code
            String redirectQuery;
            try {
                final Page redirectPage = submitInput.click();
                redirectQuery = redirectPage.getUrl().getQuery();
            } catch (FailingHttpStatusCodeException e) {
                // escalate non redirect errors
                if (e.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
                    throw e;
View Full Code Here

        final HtmlForm form = authorizationPage.getForms().get(0);
        final HtmlTextInput username = form.getInputByName("username");
        username.setValueAttribute(USERNAME);
        final HtmlPasswordInput password = form.getInputByName("password");
        password.setValueAttribute(USERNAME);
        final HtmlSubmitInput submit = form.getInputByName("submit");
        final HtmlPage callbackPage = submit.click();
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
        return callbackUrl;
    }
View Full Code Here

        final HtmlForm form = authorizationPage.getForms().get(0);
        final HtmlTextInput sessionUsernameOrEmail = form.getInputByName("session[username_or_email]");
        sessionUsernameOrEmail.setValueAttribute("testscribeup@gmail.com");
        final HtmlPasswordInput sessionPassword = form.getInputByName("session[password]");
        sessionPassword.setValueAttribute("testpwdscribeup");
        final HtmlSubmitInput submit = authorizationPage.getHtmlElementById("allow");
        final HtmlPage callbackPage = submit.click();
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
        return callbackUrl;
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlSubmitInput

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.