Examples of links()


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

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

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

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

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

  public void testDontFind() {
    addPageRequest("http://test.com",
        newHtml("Test Page", "<a id=\"t\" href=\"http://test.com/myPage.html\">myPage</a>"));
   
    AbstractDocument page = agent().get("http://test.com");
    assertEquals(1, page.links().size());
    Link link = page.links().find("#nothere");
    assertNull(link);
  }

  @Test
View Full Code Here

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

    addPageRequest("http://test.com",
        newHtml("Test Page", "<a id=\"t\" href=\"http://test.com/myPage.html\">myPage</a>"));
   
    AbstractDocument page = agent().get("http://test.com");
    assertEquals(1, page.links().size());
    Link link = page.links().find("#nothere");
    assertNull(link);
  }

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

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

    addPageRequest("http://test.com",
        newHtml("Test Page", "<a href=\"myPage.html\">myPage</a>"));
    addPageRequest("http://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.links()

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

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

        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.links()

  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']"));
  }

  @Test
 
View Full Code Here

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

  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 org.jnetpcap.protocol.application.Html.links()

    assertTrue("Can't find HTTP header", packet.hasHeader(JProtocol.HTTP_ID));

    Html html = packet.getHeader(new Html());
    assertNotNull("Can't find HTML header", html);
    System.out.printf("link related tags=%s\n", Arrays.asList(html.links())
        .toString());

    System.out.printf("All tags=%s\n", Arrays.asList(html.tags()).toString());

  }
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.