Examples of AbstractDocument


Examples of com.gistlabs.mechanize.document.AbstractDocument

    PageRequest pageRequest = addPageRequest("http://test.com",
        newHtml("Test Page", "<a href=\"myPage.html\">myPage</a>"));
    pageRequest.setContentLocation("http://www1.test.com");
    addPageRequest("http://www1.test.com/myPage.html", newHtml("My Page", ""));
   
    AbstractDocument page = agent().get("http://test.com");
    Link link = page.links().find(contains("myPage"));
    assertNotNull(link);
    Resource myPage = link.click();
    assertEquals("My Page", myPage.getTitle());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

  @Test
  public void testFollowingAnAbsoluteLink() {
    addPageRequest("http://www.test.com",
        newHtml("Test Page", "<img src=\"test.png\"/>"));
   
    AbstractDocument page = agent().get("http://www.test.com");
    Image image = page.images().find("*[src='test.png']");
    assertEquals("http://www.test.com/test.png", image.getAbsoluteSrc());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

    String username = "";
    String password = "";
    Mechanize agent = new MechanizeAgent(buildClient());

    String manageKindleUrl = "http://www.amazon.com/gp/digital/fiona/manage/ref=gno_yam_myk";
    AbstractDocument signinPage = agent.get(manageKindleUrl);

    debug(signinPage);

    Form form = signinPage.forms().get(0);
    form.get("email").setValue(username);
    ((Checkable) form.get("ap_signin_existing_radio")).setChecked(true);
    form.get("password").setValue(password);
    Resource managePage = form.submit();
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

public class WikipediaSearchForAngelaMerkelAndDownloadingImagesIT {

  @Test
  public void testLoadWikipediaIndexPage() {
    Mechanize agent = new MechanizeAgent();
    AbstractDocument page = agent.get("http://www.wikipedia.org");
    assertNotNull(page);
    assertTrue(page.size() > 10000);
    Links links = page.links();
    assertTrue(links.size() > 10);
    assertNotNull(links.find("*[title*='English']"));
  }
 
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

  }

  @Test
  public void testClickingEnglishWikipediaVersionLink() {
    Mechanize agent = new MechanizeAgent();
    AbstractDocument page = agent.get("http://www.wikipedia.org");
    assertNotNull(page);
    assertTrue(page.size() > 10000);
    Links links = page.links();
    assertTrue(links.size() > 10);
    Link link = links.find("*[title*='English']");
    assertNotNull(link);
    Resource englishPage = link.click();
    assertEquals("Wikipedia, the free encyclopedia", englishPage.getTitle());
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

  }

  @Test
  public void testSearchingWikipediaForAngelaMerkelInGermanLanguageUtilizingSelectAndTextInput() {
    Mechanize agent = new MechanizeAgent();
    AbstractDocument page = agent.get("http://www.wikipedia.org");
    Form form = page.forms().find(".search-form");
    form.findSelect(byIdOrName("language")).getOption("de").select();
    form.findSearch(byIdOrName("search")).set("Angela Merkel");
    Resource response = form.findSubmitButton(byIdOrName("go")).submit();
    assertTrue(response.getTitle().startsWith("Angela Merkel"));
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

public class GoogleSearchForMechanizeJavaIT {

  @Test
  public void testGooglePageSearchForm() {
    Mechanize agent = new MechanizeAgent();
    AbstractDocument page = agent.get("http://www.google.com");
    Form form = page.form("f");
    form.get("q").set("mechanize java");
    Resource response = form.submit();
    assertTrue(response.getTitle().startsWith("mechanize java"));
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

  public void testEmptyFormWithGetMethod() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form")));
    addPageRequest("http://test.com/form", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    Resource response = form.submit();
    assertEquals("OK", response.getTitle());
    assertFalse(form.isDoPost());
  }
View Full Code Here

Examples of com.gistlabs.mechanize.document.AbstractDocument

  public void testEmptyFormWithPostMethod() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form", "post").id("form")));
    addPageRequest("POST", "http://test.com/form", newHtml("OK", ""));

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

Examples of com.gistlabs.mechanize.document.AbstractDocument

  public void testSimpleInputNoText() {
    addPageRequest("http://test.com",
        newHtml("Test Page", newForm("form").id("form").addText("text", null)));
    addPageRequest("http://test.com/form?text=", newHtml("OK", ""));

    AbstractDocument page = agent().get("http://test.com");
    Form form = page.forms().find("#form");
    AbstractDocument response = form.submit();
    assertEquals("OK", response.getTitle());
  }
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.