Examples of HtmlInput


Examples of br.com.objectos.way.ui.builder.HtmlInput

*/
@Test
public class HtmlInputTest {

  public void input_teste() {
    HtmlInput ui = input().end();

    assertThat(ui, hasToString(equalTo("<input />")));
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

      final HtmlPage uploadPage = (HtmlPage) linkEl.click();
      if (uploadPage == null){
         fail("Could not read page");
      }
           
      final HtmlInput el1 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_FILE);
      if (el1 == null) {
         fail("Element file upload file doesn't exist");
      } else {        
         el1.type(IMAGE_TO_UPLOAD);
      }     
     
      final HtmlInput el2 = (HtmlInput) uploadPage.getFirstByXPath(FILE_UPLOAD_UPDATE);
      final HtmlPage finishPage = (HtmlPage) el2.click();
      final HtmlElement el3 = (HtmlElement) finishPage.getFirstByXPath(FILE_UPLOAD_RESPONSE);
     
      assertFalse("Page should contain \"Successfully updated\"", el3 == null);
   }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

        public RequestAssertion afterSubmittingForm(String formName,
                FormInputValue...formVals) throws Exception {
           
            HtmlForm form = ((HtmlPage)page).getFormByName(formName);
            for (FormInputValue formVal : formVals) {
                HtmlInput input = form.getInputByName(formVal.getInputName());
                formVal.handleInput(input);
            }
            HtmlSubmitInput submit = form.getInputByValue("submit");
            page = submit.click();
            return this;
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

    }

    @Test
    public void testRequest() throws Exception {
        HtmlPage page = requestPage();
        HtmlInput input = getInput(page);
        assertNotNull(input);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

    }

    @Test
    public void testRequest() throws Exception {
        HtmlPage page = requestPage();
        HtmlInput input = getInput(page);
        assertNotNull(input);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

    }

    @Test
    public void testRequest() throws Exception {
        HtmlPage page = requestPage();
        HtmlInput input = getInput(page);
        assertNotNull(input);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

        environment = null;
    }

    protected HtmlPage submitValueAndCheckMessage(String value, Matcher<String> matcher) throws Exception {
        HtmlPage page = requestPage();
        HtmlInput input = getInput(page);
        page = (HtmlPage) input.setValueAttribute(value);
        page = submit(page);
        checkMessage(page, "uiMessage", matcher);
        return page;
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

        HtmlElement message = (HtmlElement) page.getElementById(messageId);
        assertThat(message.getTextContent(), matcher);
    }

    protected HtmlPage submit(HtmlPage page) throws IOException {
        HtmlInput input = getInput(page);
        input.fireEvent("blur");
        return page;
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

    }

    protected HtmlInput getInput(HtmlPage page) {
        HtmlForm htmlForm = page.getFormByName("form");
        assertNotNull(htmlForm);
        HtmlInput input = htmlForm.getInputByName("form:text");
        return input;
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlInput

        for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) {
            HtmlForm form = (HtmlForm) iter.next();

            if ("loginAction".equals(form.getActionAttribute())) {
                formfound = true;
                HtmlInput login = form.getInputByName("login");
                HtmlInput password = form.getInputByName("password");
                login.setValueAttribute("test");
                password.setValueAttribute("password");

                resultPage = (HtmlPage) form.submit();
                // Check response from servlet
                resultResponse = resultPage.getWebResponse();
                assertTrue(resultResponse.getStatusCode() <= 200);

             
                String response = resultResponse.getContentAsString();
                assertTrue(-1 != response.indexOf("Account Information for"));
                assertTrue(-1 != response.indexOf("Test"));
                assertTrue(-1 != response.indexOf("134-42-6231"));
                assertTrue(-1 != response.indexOf("123.43"));
                assertTrue(-1 != response.indexOf("134-43-3941"));
                assertTrue(-1 != response.indexOf("23.12"));

                Pattern pat = Pattern.compile("LU.*7", Pattern.DOTALL);
                Matcher test = pat.matcher(response);
                assertTrue(test.find());
            }

        }
        forms = resultPage.getForms();
       
        formfound = false;
        for(Iterator iter = forms.iterator();  formfound != true && iter.hasNext();) {
            HtmlForm form = (HtmlForm) iter.next();

            if ("purchaseStock.jsp".equals(form.getActionAttribute())) {
                formfound = true;
                resultPage = (HtmlPage) form.submit();
            }

        }
        assertTrue(formfound);
        forms = resultPage.getForms();
        formfound = false;
        for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) {
            HtmlForm form = (HtmlForm) iter.next();

            if ("FormServlet".equals(form.getActionAttribute())) {
                formfound = true;

                HtmlInput login = form.getInputByName("symbol");
                HtmlInput password = form.getInputByName("quantity");
                login.setValueAttribute("EDS");
                password.setValueAttribute("131");
               
                resultPage = (HtmlPage) form.submit();
                // Check response from servlet
                resultResponse = resultPage.getWebResponse();
                assertTrue(resultResponse.getStatusCode() <= 200);

            
                String response = resultResponse.getContentAsString();
                assertTrue(-1 != response.indexOf("Account Information for"));
                assertTrue(-1 != response.indexOf("Test"));
                assertTrue(-1 != response.indexOf("134-42-6231"));
                assertTrue(-1 != response.indexOf("123.43"));
                assertTrue(-1 != response.indexOf("134-43-3941"));
                assertTrue(-1 != response.indexOf("23.12"));

                Pattern pat = Pattern.compile("LU.*7", Pattern.DOTALL);
                Matcher test = pat.matcher(response);
                assertTrue(test.find());
                pat = Pattern.compile("EDS.*131", Pattern.DOTALL);
                test = pat.matcher(response);
                assertTrue(test.find());

            }

        }
        assertTrue(formfound);
        forms = resultPage.getForms();
        formfound = false;
        for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) {
            HtmlForm form = (HtmlForm) iter.next();

            if ("stockSale.jsp".equals(form.getActionAttribute())) {
//                System.err.println(form.asText());
               
               
               
                Pattern pat = Pattern.compile("EDS.*131", Pattern.DOTALL);
               
                Matcher test = pat.matcher(form.asText());
                if(!test.find()) continue;

               
               
               
                formfound = true;
                resultPage = (HtmlPage) form.submit();
                // Check response from servlet
                resultResponse = resultPage.getWebResponse();
                assertTrue(resultResponse.getStatusCode() <= 200);


            }

        }
        forms = resultPage.getForms();
       
       
       
        formfound = false;
        for(Iterator iter = forms.iterator();  formfound != true && iter.hasNext();) {
            HtmlForm form = (HtmlForm) iter.next();

            if ("FormServlet".equals(form.getActionAttribute())) {
                formfound = true;

               
                HtmlInput password = form.getInputByName("quantity");
               
                password.setValueAttribute("131");

                resultPage = (HtmlPage) form.submit();
                // Check response from servlet
                resultResponse = resultPage.getWebResponse();
                assertTrue(resultResponse.getStatusCode() <= 200);
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.