Examples of WebForm


Examples of com.meterware.httpunit.WebForm

    itemTable.purgeEmptyCells();
    String[][] table = itemTable.asText();
    assertEquals( "EST-4", table[1][0].trim());
   
    // Set quantity to 3
    WebForm form = resp.getFormWithID("cart");
    form.setParameter("{actionForm.cart.lineItems[0].quantity}", "3");
    resp = form.submit();
   
    // Make sure the Total is $55.50
    itemTable = resp.getTableStartingWith("Item ID");
    itemTable.purgeEmptyCells();
    table = itemTable.asText();
View Full Code Here

Examples of com.meterware.httpunit.WebForm

   
    // Click the Sign In link
    resp = resp.getLinkWith("Sign In").click();
   
    // Enter the username/password in the form
    WebForm form = resp.getForms()[1];
    form.setParameter( "j_username", userName );
    form.setParameter( "j_password", password );
   
    // Submit
    return form.submit();
  }
View Full Code Here

Examples of com.meterware.httpunit.WebForm

        String uri = URI.create("http://www.taobao.com/readfile" + "?file=" + htmlfile).normalize().toString();

        // 取得初始页面和form
        WebResponse response = client.getResponse(new GetMethodWebRequest(uri));

        WebForm form = response.getFormWithName("myform");

        // 取得提交form的request
        WebRequest request = form.getRequest();

        request.setParameter("myparam", new String[] { "hello",
                                                       "中华人民共和国" });

        try {
View Full Code Here

Examples of com.meterware.httpunit.WebForm

        client = servletRunner.newClient();

        // 取得初始页面form.html
        WebResponse response = client.getResponse(new GetMethodWebRequest("http://localhost/myservlet"));

        WebForm form = response.getFormWithName("myform");

        // 取得提交form的request
        WebRequest request = form.getRequest();

        request.setParameter("myparam", "中华人民共和国");
        request.selectFile("myfile", new File(srcdir, "smallfile.txt"));

        File nonAsciiFile = 中文文件名;
View Full Code Here

Examples of com.meterware.httpunit.WebForm

        String uri = URI.create("http://www.taobao.com/readfile" + "?file=" + htmlfile).normalize().toString();

        // 取得初始页面和form
        WebResponse response = client.getResponse(new GetMethodWebRequest(uri));

        WebForm form = response.getFormWithName("myform");

        // 取得提交form的request
        WebRequest request = form.getRequest();

        request.setParameter("myparam", new String[] { "hello",
                                                       "中华人民共和国" });

        try {
View Full Code Here

Examples of com.meterware.httpunit.WebForm

    public void testVersion() throws Exception {
        WebConversation conversation = new WebConversation();
        // Fill the form and submit it
        WebRequest request = new GetMethodWebRequest(getServerUrl());
        WebResponse response = conversation.getResponse(request);
        WebForm formUMLText = response.getForms()[0];
        formUMLText.setParameter("text", "version");
        response = formUMLText.submit();
        // Analyze response
        WebForm[] forms = response.getForms();
        assertEquals(2, forms.length);
        // Ensure the Text field is correct
        assertEquals("version", forms[0].getParameterValue("text"));
View Full Code Here

Examples of com.meterware.httpunit.WebForm

    public void testEmptyText() throws Exception {
        WebConversation conversation = new WebConversation();
        // Fill the form and submit it
        WebRequest request = new GetMethodWebRequest(getServerUrl());
        WebResponse response = conversation.getResponse(request);
        WebForm formUMLText = response.getForms()[0];
        formUMLText.setParameter("text", "");
        response = formUMLText.submit();
        // Analyze response
        WebForm[] forms = response.getForms();
        assertEquals(2, forms.length);
        // Ensure the Text field is empty
        assertNull(forms[0].getParameterValue("text"));
View Full Code Here

Examples of com.meterware.httpunit.WebForm

    public void testEmptyUrl() throws Exception {
        WebConversation conversation = new WebConversation();
        // Fill the form and submit it
        WebRequest request = new GetMethodWebRequest(getServerUrl());
        WebResponse response = conversation.getResponse(request);
        WebForm formUrl = response.getForms()[1];
        formUrl.setParameter("url", "");
        response = formUrl.submit();
        // Analyze response
        WebForm[] forms = response.getForms();
        assertEquals(2, forms.length);
        // Ensure the Text field is empty
        assertNull(forms[0].getParameterValue("text"));
View Full Code Here

Examples of com.meterware.httpunit.WebForm

    public void testDitaaText() throws Exception {
        WebConversation conversation = new WebConversation();
        // Fill the form and submit it
        WebRequest request = new GetMethodWebRequest(getServerUrl());
        WebResponse response = conversation.getResponse(request);
        WebForm formDitaaText = response.getForms()[0];
        formDitaaText.setParameter("text", "@startditaa \n*--> \n@endditaa");
        response = formDitaaText.submit();
        // Analyze response
        WebForm[] forms = response.getForms();
        assertEquals(2, forms.length);
        // Ensure the Text field is correct
        assertTrue(forms[0].getParameterValue("text").startsWith("@startditaa"));
View Full Code Here

Examples of com.meterware.httpunit.WebForm

    public void testImageMap() throws Exception {
        WebConversation conversation = new WebConversation();
        // Fill the form and submit it
        WebRequest request = new GetMethodWebRequest(getServerUrl());
        WebResponse response = conversation.getResponse(request);
        WebForm formText = response.getForms()[0];
        formText.setParameter("text", "@startuml \nBob -> Alice : [[http://yahoo.com]] Hello \n@enduml");
        response = formText.submit();
        // Analyze response
        // Ensure the generated image is present
        assertNotNull(response.getImageWithAltText("PlantUML diagram"));
        // Ensure the image map is present
        HTMLElement[] maps = response.getElementsByTagName("map");
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.