Examples of HtmlForm


Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    /**
     * Manual submission form.
     */
    public void testUploadHpi() throws Exception {
        HtmlPage page = new WebClient().goTo("pluginManager/advanced");
        HtmlForm f = page.getFormByName("uploadPlugin");
        File dir = env.temporaryDirectoryAllocator.allocate();
        File plugin = new File(dir, "legacy.hpi");
        FileUtils.copyURLToFile(getClass().getClassLoader().getResource("plugins/legacy.hpi"),plugin);
        f.getInputByName("name").setValueAttribute(plugin.getAbsolutePath());
        submit(f);

        // uploaded legacy plugins get renamed to *.jpi
        assertTrue( new File(hudson.getRootDir(),"plugins/legacy.jpi").exists() );
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        localPort = connector.getLocalPort();

        try {
            WebClient wc = new WebClient();
            HtmlPage p = (HtmlPage) wc.getPage("http://localhost:" + localPort + '/');
            HtmlForm f = p.getFormByName("main");
            HtmlFileInput input = (HtmlFileInput) f.getInputByName("test");
            input.setData(testData);
            f.submit();
        } finally {
            server.stop();
        }
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    // ========================================================================

    private void doTestSimple() throws Exception {
        HtmlPage p = createWebClient().goTo("self/testSimple");
        HtmlForm f = p.getFormByName("config");
        f.getButtonByCaption("Add").click();
        f.getInputByValue("").setValueAttribute("value one");
        f.getButtonByCaption("Add").click();
        f.getInputByValue("").setValueAttribute("value two");
        f.getButtonByCaption("Add").click();
        f.getInputByValue("").setValueAttribute("value three");
        f.getInputsByName("bool").get(2).click();
        submit(f);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    }

    public void testMinimum() throws Exception {
        minimum = 3;
        HtmlPage p = createWebClient().goTo("self/testSimple");
        HtmlForm f = p.getFormByName("config");
        f.getInputByValue("").setValueAttribute("value one");
        f.getInputByValue("").setValueAttribute("value two");
        f.getInputByValue("").setValueAttribute("value three");
        try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { }
        f.getInputsByName("bool").get(2).click();
        submit(f);
        assertEquals("[{\"bool\":false,\"txt\":\"value one\"},"
            + "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":true,\"txt\":\"value three\"}]",
            formData.get("foos").toString());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    public void testMinimum_ExistingData() throws Exception {
        addData();
        minimum = 3;
        HtmlPage p = createWebClient().goTo("self/testSimple");
        HtmlForm f = p.getFormByName("config");
        f.getInputByValue("").setValueAttribute("new one");
        try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { }
        f.getInputsByName("bool").get(1).click();
        submit(f);
        assertEquals("[{\"bool\":true,\"txt\":\"existing one\"},"
            + "{\"bool\":true,\"txt\":\"existing two\"},{\"bool\":false,\"txt\":\"new one\"}]",
            formData.get("foos").toString());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

                formData.get("list").toString());
    }
   
    private void gotoAndSubmitConfig(final String viewName) throws Exception {
        HtmlPage p = createWebClient().goTo("self/" + viewName);
        HtmlForm f = p.getFormByName("config");
        submit(f);
    }
View Full Code Here

Examples of info.bliki.htmlcleaner.util.HtmlForm

    }

    // To have fallen through, the response code had to have been ok.
    // Now parse out the editform into the utility class HtmlForm.
    HtmlForm form = new HtmlForm("editform", HtmlForm.POST, "", "");
    // HtmlUtilities.extractForm("editform", responseBody);
    new HtmlFormExtractor(form).extractContent(responseBody);
    String empty = "";
    String startTime = empty, editTime = empty, editText = empty, autoSummary = empty, editToken = empty;

    if (form != null) {

      int sz = form.getElementCount();

      // Step through the form elements to find key items needed to
      // construct an instance of EditFormData.
      for (int i = 0; i < sz; i++) {

        HtmlForm.Element element = form.getElement(i);
        HtmlForm.ElementAttribute nameAttr = element.getElementAttributeByName("name");
        HtmlForm.ElementAttribute valueAttr = element.getElementAttributeByName("value");

        String name = nameAttr != null ? nameAttr.getValue() : null;
View Full Code Here

Examples of javax.faces.component.html.HtmlForm

        resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
    }

    public void testSaveRestoreChildrenState() throws Exception {
        HtmlForm form = new HtmlForm();
        HtmlInputText input = new HtmlInputText();
        IterationStateHolderComponent stateHolder = new IterationStateHolderComponent();

        List<UIComponent> children = mockDataAdaptor.getChildren();
        children.add(form);
        form.getChildren().add(input);
        form.getFacets().put("facet", stateHolder);

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));

        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());

        form.setSubmitted(true);
        input.setSubmittedValue("user input");
        input.setValue("component value");
        input.setValid(false);
        input.setLocalValueSet(true);
        stateHolder.setIterationState("state");

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));

        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());

        input.setSubmittedValue("another input from user");
        input.setValue("123");
        assertTrue(input.isLocalValueSet());
        stateHolder.setIterationState("456");

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
        assertTrue(form.isSubmitted());
        assertEquals("user input", input.getSubmittedValue());
        assertEquals("component value", input.getLocalValue());
        assertFalse(input.isValid());
        assertTrue(input.isLocalValueSet());
        assertEquals("state", stateHolder.getIterationState());

        mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
        assertFalse(form.isSubmitted());
        assertEquals("another input from user", input.getSubmittedValue());
        assertEquals("123", input.getLocalValue());
        assertTrue(input.isValid());
        assertTrue(input.isLocalValueSet());
        assertEquals("456", stateHolder.getIterationState());

        mockDataAdaptor.setRowKey(facesContext, null);
        assertFalse(form.isSubmitted());
        assertNull(input.getSubmittedValue());
        assertNull(input.getLocalValue());
        assertTrue(input.isValid());
        assertFalse(input.isLocalValueSet());
        assertNull(stateHolder.getIterationState());
View Full Code Here

Examples of org.mojavemvc.tests.views.HTMLForm

    }

    @Action("form2")
    public View form2() {
       
        return new HTMLForm()
            .withAction("form-controller/process2?p1=hello")
            .withTextInput("userName", "userName")
            .withPasswordInput();
    }
View Full Code Here

Examples of org.mojavemvc.tests.views.HTMLForm

    }

    @Action("form3")
    public View form3() {
       
        return new HTMLForm()
            .withAction("form-controller/process3")
            .withTextInput("userName", "userName")
            .withPasswordInput();
    }
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.