Examples of forms()


Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addInput("unknown", "unknownType", null)));
    addPageRequest("http://test.com/form?unknown=test", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    FormElement unknown = form.find(byName("unknown"));
    assertNotNull(unknown);
    assertTrue(unknown instanceof FormElement);
    unknown.setValue("test");
    AbstractDocument response = form.submit();
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

        .addRaw("<input type=\"text\" class=\"txt\" name=\"login\" size=\"30\" onfocus=\"hlFF(this, true);\" onblur=\"hlFF(this);\">"));
    addPageRequest("http://test.com",
        newHtml);

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    FormElement login = form.find(byIdOrName("login"));
    assertNotNull(login);
    assertTrue(login instanceof FormElement);
    login.setValue("test");
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addTextArea("text", "Text")));
    addPageRequest("http://test.com/form?text=Text", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    AbstractDocument response = form.submit();
    assertEquals("OK", response.getTitle());
  }

  public void testTextAreaInputWithChangedValue() {
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addTextArea("text", "Text")));
    addPageRequest("http://test.com/form?text=differentText", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    form.findTextArea(byIdOrName("text")).setValue("differentText");
    AbstractDocument response = form.submit();
    assertEquals("OK", response.getTitle());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addHidden("hidden", "Text")));
    addPageRequest("http://test.com/form?hidden=Text", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    AbstractDocument response = form.submit();
    assertEquals("OK", response.getTitle());
  }

  @Test(expected = UnsupportedOperationException.class)
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

  public void testSettingValueOfSubmitButtonFails() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addSubmitButton("button", "Text")));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    form.find(byIdOrName("button")).setValue("shouldFail");
  }

  @Test
  public void testSimpleLoginFormWithTextAndPasswordAndSubmitButtonSubmittingByButton() {
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addText("user", null).addPassword("pass", null).addSubmitButton("submit", "pressed")));
    addPageRequest("http://test.com/form?user=username&pass=password&submit=pressed", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    form.find(byIdOrName("user")).setValue("username");
    form.find(byIdOrName("pass")).setValue("password");
    AbstractDocument response = form.findSubmitButton(byIdOrName("submit")).submit();
    assertEquals("OK", response.getTitle());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addText("user", null).addPassword("pass", null).addSubmitButton("submit", "pressed")));
    addPageRequest("http://test.com/form?user=username&pass=password", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    form.find(byIdOrName("user")).setValue("username");
    form.find(byIdOrName("pass")).setValue("password");
    AbstractDocument response = form.submit();
    assertEquals("OK", response.getTitle());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

  public void testCheckboxForm() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addCheckbox("box", "value1").addCheckedCheckbox("box", "value2").addCheckedCheckbox("box", "value3")));
    addPageRequest("http://test.com/form?box=value1&box=value3", newHtml("OK", ""));
    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    assertFalse(form.findCheckbox(byIdOrName("box"), "value1").isChecked());
    assertTrue(form.findCheckbox(byIdOrName("box"), "value2").isChecked());
    assertTrue(form.findCheckbox(byIdOrName("box"), "value3").isChecked());
    assertEquals(3, form.findAll(byIdOrName("box"), Checkbox.class).size());
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument.forms()

  public void testSettingValueOfCheckboxFails() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addCheckbox("box", "value")));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    form.findCheckbox(byIdOrName("box")).setValue("shouldFail");
  }

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