Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlTextInput


        // setUp() should have put us on the page
        assertEquals("Shale Token Test", title());

        // Fill in the required value and submit the form
        HtmlTextInput value = (HtmlTextInput) element("form:value");
        value.setValueAttribute("Value");
        HtmlSubmitInput submit = (HtmlSubmitInput) element("form:submit");
        submit(submit);

        // Validate that we have returned to the main page
        assertEquals("Shale Framework Use Cases", title());
View Full Code Here


        HtmlForm form = null;
        HtmlElement message = null;
        HtmlElement messages = null;
        HtmlHiddenInput token = null;
        HtmlSubmitInput submit = null;
        HtmlTextInput value = null;

        // setUp() should have put us on the page
        assertEquals("Shale Token Test", title());
        form = (HtmlForm) element("form");
        assertNotNull(form);
        messages = element("form:messages");
        // MyFaces 1.1 and the JSF RI 1.1 are inconsistent about whether the
        // "messages" element is actually created when there are no messages
//        assertNull(messages);
        value = (HtmlTextInput) element("form:value");
        assertNotNull(value);
        assertEquals("", value.getValueAttribute());
        message = element("form:valueMessage");
        assertNull(message);
        token = (HtmlHiddenInput) element("form:token");
        assertNotNull(token);
        assertNotNull(token.getValueAttribute());
View Full Code Here

        // Reproduce the steps that testValidate() performs
        testValidate();

        // Fix the validation error and submit the form
        HtmlPage save = this.page;
        HtmlTextInput value = (HtmlTextInput) element("form:value");
        value.setValueAttribute("Value");
        HtmlSubmitInput submit = (HtmlSubmitInput) element("form:submit");
        submit(submit);

        // Verify that we were returned to the main menu
        assertEquals("Shale Framework Use Cases", title());

        // Restore the saved page and submit it again
        this.page = save;
        value = (HtmlTextInput) element("form:value");
        value.setValueAttribute("Value");
        submit = (HtmlSubmitInput) element("form:submit");
        submit(submit);

        // Verify we stayed on the same page with appropriate error messages
        assertEquals("Shale Token Test", title());
View Full Code Here

     * <p>Submit incorrect input fields and verify the correct response.</p>
     */
    public void testIncorrect() throws Exception {

        HtmlSpan span = null;
        HtmlTextInput username = (HtmlTextInput) element("form:username");
        HtmlPasswordInput password = (HtmlPasswordInput)
            element("form:password");
        HtmlSubmitInput submit = (HtmlSubmitInput) element("form:submit");

        username.setValueAttribute("bb");
        password.setValueAttribute("");
        submit(submit);

        assertEquals("logon", title());

        span = (HtmlSpan) element("globalErrors");
        assertNotNull(span);
        assertEquals("[EH][EP] can not be less than 3 characters.[ES]" +
                     "[EP] is required.[ES][EF]",
                     span.asText());

        username = (HtmlTextInput) element("form:username");
        assertNotNull(username);
        assertEquals("bb", username.getValueAttribute());

        span = (HtmlSpan) element("form:usernameErrors");
        assertNotNull(span);
        // FIXME:  response string should really include "Username:"
        assertEquals("[EH][EP] can not be less than 3 characters.[ES][EF]",
View Full Code Here

        span = (HtmlSpan) element("form:usernamePrompt");
        assertNotNull(span);
        assertEquals("Username:", span.asText());

        HtmlTextInput username = (HtmlTextInput) element("form:username");
        assertNotNull(username);
        assertEquals("", username.getLangAttribute());
        assertEquals("form:username", username.getNameAttribute());
        assertEquals("", username.getOnClickAttribute());
        assertEquals("", username.getOnDblClickAttribute());
        assertEquals("", username.getOnKeyDownAttribute());
        assertEquals("", username.getOnKeyPressAttribute());
        assertEquals("", username.getOnKeyUpAttribute());
        assertEquals("", username.getOnMouseDownAttribute());
        assertEquals("", username.getOnMouseMoveAttribute());
        assertEquals("", username.getOnMouseOutAttribute());
        assertEquals("", username.getOnMouseOverAttribute());
        assertEquals("", username.getOnMouseUpAttribute());
        assertEquals("text", username.getTypeAttribute());
        assertEquals("", username.getValueAttribute());

        span = (HtmlSpan) element("form:passwordPrompt");
        assertNotNull(span);
        assertEquals("Password:", span.asText());
View Full Code Here

     * <p>Submit known-bad mismatch and verify the correct response.</p>
     */
    public void testMismatch() throws Exception {

        HtmlSpan span = null;
        HtmlTextInput username = (HtmlTextInput) element("form:username");
        HtmlPasswordInput password = (HtmlPasswordInput)
            element("form:password");
        HtmlSubmitInput submit = (HtmlSubmitInput) element("form:submit");

        username.setValueAttribute("baduser");
        password.setValueAttribute("badpass");
        submit(submit);

        assertEquals("logon", title());

        span = (HtmlSpan) element("globalErrors");
        assertNotNull(span);
        assertEquals("[EH][EP]Invalid username/password combination[ES][EF]",
                     span.asText());

        username = (HtmlTextInput) element("form:username");
        assertNotNull(username);
        assertEquals("baduser", username.getValueAttribute());

        span = (HtmlSpan) element("form:usernameErrors");
        assertNotNull(span);
        assertEquals("", span.asText());

View Full Code Here

     * <p>Submit known-good username and password values, and
     * verify the correct response.</p>
     */
    public void testSuccessful() throws Exception {

        HtmlTextInput username = (HtmlTextInput) element("form:username");
        HtmlPasswordInput password = (HtmlPasswordInput)
            element("form:password");
        HtmlSubmitInput submit = (HtmlSubmitInput) element("form:submit");

        username.setValueAttribute("gooduser");
        password.setValueAttribute("goodpass");
        submit(submit);

        assertEquals("logon1", title());

View Full Code Here

  @Override
  public void enterToTextField(String formId, String fieldId, String value) {
    log("Entering '" + value + "' to text field '" + formId + ":" + fieldId
        + "'");
    HtmlForm form = htmlPage().getFormByName(formId);
    HtmlTextInput field = (HtmlTextInput) form.getInputByName(fieldId);
    page = field.setValueAttribute(value);
  }
View Full Code Here

        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

        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

TOP

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

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.