Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebForm.submit()


      // submit data
      WebForm form = webResponse.getFormWithID("form1");
      form.setParameter("form1:input_foo_text", "Stan");
      SubmitButton submitButton = form.getSubmitButtonWithID("form1:submit_button");
      webResponse = form.submit(submitButton);
      assertTrue(contains(webResponse.getText(), "Hello Stan"));
   }
  
   private String getResponseBody(String warName) throws Exception
   {
View Full Code Here


        wc.getResponse(requestUrl("/TestInput.do"));
        {
            WebForm form = wc.getCurrentPage().getForms()[0];
            form.setParameter("givenName", "Archie");
            form.setParameter("familyName", "Trajano");
            form.submit();
        }
        {
            WebForm form = wc.getCurrentPage().getForms()[0];
            assertEquals("Archie", form.getParameterValue("givenName"));
            assertEquals("Trajano", form.getParameterValue("familyName"));
View Full Code Here

        // check if the search returns more than one result for "cat
        WebForm form = resp.getForms()[0];
        assertEquals("on", form.getParameterValue("searchForm:searchTags"));
        String searchText = "cat";
        form.setParameter("searchForm:searchString", searchText);
        form.submit();
        resp = wc.getCurrentPage();
        WebTable resultTable = resp.getTableStartingWithPrefix("Map");
        assertTrue(resultTable.getRowCount() > 2);
    }
}
View Full Code Here

     * @throws Exception
     */
    private WebResponse submitWithParam(WebResponse orig, String formname, String paramname, String value) throws Exception {
        WebForm form = orig.getFormWithName(formname);
        form.setParameter(paramname,value);
        return form.submit();
    }

    /**
     * Used for debugging testcases
     * @param resp webresponse
View Full Code Here

        /* check getString(bar,foo) */
        WebForm form = resp.getFormWithName("getString2");
        form.setParameter("getString1","'bar'");
        form.setParameter("getString2","'foo'");
        resp = form.submit();
        checkText(resp,"getString2","foo");

        /* TODO other getters with default values */

        /* check all */
 
View Full Code Here

     * @throws Exception
     */
    private WebResponse submitWithParam(WebResponse orig, String formname, String paramname, String value) throws Exception {
        WebForm form = orig.getFormWithName(formname);
        form.setParameter(paramname,value);
        return form.submit();
    }

    /**
     * Used for debugging testcases
     * @param resp webresponse
View Full Code Here

        /* check add('foo','bar') */
        WebForm form = resp.getFormWithName("add2");
        form.setParameter("add1","foo");
        form.setParameter("add2","bar");
        resp = form.submit();
        resp = submitWithParam(resp,"get","get","foo");
        checkTextStart(resp,"get","javax.servlet.http.Cookie");
    }

    public @Test void testLinkTool() throws Exception {
View Full Code Here

        /* check getString(bar,foo) */
        WebForm form = resp.getFormWithName("getString2");
        form.setParameter("getString1","'bar'");
        form.setParameter("getString2","'foo'");
        resp = form.submit();
        checkText(resp,"getString2","foo");

        /* TODO other getters with default values */

        /* check all */
 
View Full Code Here

     * @throws Exception
     */
    private WebResponse submitWithParam(WebResponse orig, String formname, String paramname, String value) throws Exception {
        WebForm form = orig.getFormWithName(formname);
        form.setParameter(paramname,value);
        return form.submit();
    }

    /**
     * Used for debugging testcases
     * @param resp webresponse
View Full Code Here

        /* check add('foo','bar') */
        WebForm form = resp.getFormWithName("add2");
        form.setParameter("add1","foo");
        form.setParameter("add2","bar");
        resp = form.submit();
        resp = submitWithParam(resp,"get","get","foo");
        checkTextStart(resp,"get","javax.servlet.http.Cookie");
    }

    public @Test void testLinkTool() throws Exception {
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.