Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.click()


        HtmlPage page = client.getPage(getPath("/storm.jsf"));
        HtmlSubmitInput disasterButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "disasterButton");
        HtmlTextInput strength = getFirstMatchingElement(page, HtmlTextInput.class, "stormStrength");
        strength.setValueAttribute("10");
        page = disasterButton.click();
        Assert.assertEquals("Application Error", page.getTitleText());

        HtmlDivision conversationValue = getFirstMatchingElement(page, HtmlDivision.class, "conversation");
        Assert.assertEquals("10", conversationValue.asText());
View Full Code Here


        Assert.assertNotNull(employeeMethodName);
        Assert.assertNotNull(saveButton);

        employeeFieldName.setValueAttribute("Pete");
        employeeMethodName.setValueAttribute("Gavin");
        saveButton.click();
    }

    protected String getPath(String page) {
        return url + page;
    }
View Full Code Here

        ((HtmlInput) page.getElementById(GUESS_FIELD)).setValueAttribute(String.valueOf(guess));
        HtmlSubmitInput submitButton = (HtmlSubmitInput) page.getElementById(GUESS_SUBMIT);
        if (submitButton.isDisabled()) {
            throw new RuntimeException("Guess button disabled on page: " + page.asText());
        }
        return submitButton.click();
    }

    protected boolean isOnGuessPage(HtmlPage page) {
        return !(isOnWinPage(page) || isOnLosePage(page));
    }
View Full Code Here

        WebClient client = new WebClient();
        client.setThrowExceptionOnFailingStatusCode(true);

        HtmlPage page = client.getPage(getPath("/storm.jsf"));
        HtmlSubmitInput invalidateSessionButton = getFirstMatchingElement(page, HtmlSubmitInput.class, "invalidateSessionButton");
        page = invalidateSessionButton.click();
        HtmlInput inputField = getFirstMatchingElement(page, HtmlInput.class, "prop");
        Assert.assertEquals(Storm.PROPERTY_VALUE, inputField.getValueAttribute());

        // Make another request to verify that the session bean value is not the
        // one from the previous invalidated session.
View Full Code Here

    @Test
    public void testNoDoubleDestructionOnExternalRedirect() throws Exception {
        WebClient client = new WebClient();
        HtmlPage page = client.getPage(getPath("/storm.jsf"));
        HtmlSubmitInput button = getFirstMatchingElement(page, HtmlSubmitInput.class, "redirectButton");
        button.click();
    }

    protected String getPath(String page) {
        return url + page;
    }
View Full Code Here

        HtmlSubmitInput button = form.getInputByName("Login");
        HtmlTextInput textFieldUsername = form.getInputByName("username");
        HtmlPasswordInput textFieldPassword = form.getInputByName("pw");
        textFieldUsername.setValueAttribute(username);
        textFieldPassword.setValueAttribute(password);
        return button.click();
    }
   
}
View Full Code Here

        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));

        // Begin long-running conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
        // Set input value
        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(STORM_STRENGTH);
        String stormCid = getCid(storm);
        // Submit value and forward to the next form
View Full Code Here

        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(STORM_STRENGTH);
        String stormCid = getCid(storm);
        // Submit value and forward to the next form
        HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
        HtmlPage thunder = thunderButton.click();

        assertEquals(stormCid, getCid(thunder));
        stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
        assertEquals(stormStrength.getValueAttribute(), STORM_STRENGTH);
    }
View Full Code Here

        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));

        // Begin long-running conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
        // Set input value
        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(REDIRECT_STORM_STRENGTH);
        String stormCid = getCid(storm);
        // Submit value and redirect to the next form
View Full Code Here

        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(REDIRECT_STORM_STRENGTH);
        String stormCid = getCid(storm);
        // Submit value and redirect to the next form
        HtmlSubmitInput lighteningButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "lighteningButton");
        HtmlPage lightening = lighteningButton.click();

        assertTrue(lightening.getWebResponse().getWebRequest().getUrl().toString().contains("lightening.jsf"));
        assertEquals(stormCid, getCid(lightening));
        stormStrength = getFirstMatchingElement(lightening, HtmlTextInput.class, "stormStrength");
        assertEquals(stormStrength.getValueAttribute(), REDIRECT_STORM_STRENGTH);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.