Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm


    @LocalData
    @Email("http://www.nabble.com/Hudson.configure-calling-deprecated-Descriptor.configure-td19051815.html")
    public void testSimpleConfigSubmit() throws Exception {
        // just load the page and resubmit
        HtmlPage configPage = new WebClient().goTo("configure");
        HtmlForm form = configPage.getFormByName("config");
        submit(form);

        // make sure all the pieces are intact
        assertEquals(2,hudson.getNumExecutors());
        assertSame(Mode.NORMAL,hudson.getMode());
View Full Code Here


        // emulate the user behavior
        WebClient webClient = new WebClient();
        HtmlPage page = webClient.getPage(project,"configure");

        HtmlForm form = page.getFormByName("config");
        submit(form);

        List<Builder> builders = project.getBuilders();
        assertEquals(1,builders.size());
        assertEquals(Shell.class,builders.get(0).getClass());
View Full Code Here

    public void testUpstreamPseudoTrigger3() throws Exception {
        pseudoTriggerTest(createMatrixProject(), createFreeStyleProject());
    }

    private void pseudoTriggerTest(AbstractProject up, AbstractProject down) throws Exception {
        HtmlForm form = new WebClient().getPage(down, "configure").getFormByName("config");
        form.getInputByName("pseudoUpstreamTrigger").setChecked(true);
        form.getInputByName("upstreamProjects").setValueAttribute(up.getName());
        submit(form);

        // make sure this took effect
        assertTrue(up.getDownstreamProjects().contains(down));
        assertTrue(down.getUpstreamProjects().contains(up));
View Full Code Here

    public void testRoundtrip() throws Exception {
        ListView foo = new ListView("foo");
        hudson.addView(foo);

        // make sure it renders as optionalBlock
        HtmlForm f = createWebClient().getPage(foo, "configure").getFormByName("viewConfig");
        ((HtmlLabel)f.selectSingleNode(".//LABEL[text()='Debug Property']")).click();
        submit(f);
        ViewPropertyImpl vp = foo.getProperties().get(ViewPropertyImpl.class);
        assertEquals("Duke",vp.name);

        // make sure it roundtrips correctly
View Full Code Here

    /**
     * Tests the basic UI behavior of the node monitoring
     */
    public void testConfiguration() throws Exception {
        HudsonTestCase.WebClient client = new WebClient();
        HtmlForm form = client.goTo("computer/configure").getFormByName("config");
        submit(form);
    }
View Full Code Here

    try
    {
      String userName = null;
      String password = null;
     
      HtmlForm form = client.<HtmlPage>getPage("http://www.thehaloforum.com").getForms( ).get(0);
     
      form.<HtmlTextInput>getInputByName("vb_login_username").setText(userName);
      form.<HtmlPasswordInput>getInputByName("vb_login_password").setText(password);
      form.<HtmlSubmitInput>getInputByValue("Log in").<HtmlPage>click( );
    }
    catch (Exception e)
    {
      logger.log
      (
View Full Code Here

      client.closeAllWindows( );
      logIn( );
    }
   
    HtmlPage page;
    HtmlForm form;
    HtmlInput submit;
   
    page =
    (
      client.<HtmlPage>getPage
      (
        String.format
        (
          "http://www.thehaloforum.com/newreply.php?t=%d",
          threadID
        )
      )
    );
   
    form = page.getFormByName("vbform");
   
    form.getTextAreaByName("message").setText(message);
   
    submit = form.getInputByName("sbutton");
   
    form.getSelectByName("emailupdate").getOptionByValue("9999").setSelected(true);
   
    submit.click( );
  }
View Full Code Here

    /**
     * <p>Validate pristine instance of the "Token" test page.</p>
     */
    public void testPristine() throws Exception {

        HtmlForm form = null;
        HtmlElement messages = null;
        HtmlSubmitInput submit = null;

        // setUp() should have put us on the page
        assertEquals("Exception Handling Test", title());
View Full Code Here

     */
    protected HtmlForm form(String id) throws Exception {

        Iterator forms = page.getForms().iterator();
        while (forms.hasNext()) {
            HtmlForm form = (HtmlForm) forms.next();
            if (id.equals(form.getAttributeValue("id"))) {
                return (form);
            }
        }
        return (null);

View Full Code Here

    /**
     * <p>Verify the availability of an appropriate form.</p>
     */
    public void testForm() throws Exception {

        HtmlForm form = (HtmlForm) element("usecasesForm");
        assertNotNull(form);
        assertEquals("", form.getAcceptAttribute());
        assertEquals("", form.getAcceptCharsetAttribute());
        String action = form.getActionAttribute();
        int semicolon = action.indexOf(";jsessionid=");
        if (semicolon >= 0) {
            action = action.substring(0, semicolon);
        }
        assertEquals("/shale-usecases/usecases.faces", action);
        assertEquals("application/x-www-form-urlencoded", form.getEnctypeAttribute());
        assertEquals("", form.getLangAttribute());
        assertEquals("post", form.getMethodAttribute());
        // assertEquals("", form.getNameAttribute()); // Remove test for RI behavior that is not in the spec
        assertEquals("", form.getOnResetAttribute());
        assertEquals("", form.getOnSubmitAttribute());
        assertEquals("", form.getTargetAttribute());

    }
View Full Code Here

TOP

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

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.