Пример #1
0
  public void testMoveToTagWithTwice() {
    assertTrue(scraper.moveToTagWith("bgcolor", "ffffff"));
    assertFalse(scraper.moveToTagWith("bgcolor", "ffffff"));

    scraper.scrape(TEST_PAGE + TEST_PAGE);
    assertTrue(scraper.moveToTagWith("bgcolor", "ffffff"));
    assertTrue(scraper.moveToTagWith("bgcolor", "ffffff"));
    assertFalse(scraper.moveToTagWith("bgcolor", "ffffff"));
  }
Пример #2
0
  public void testMove() {
    assertTrue(scraper.move("td"));
    assertEquals("FOO", scraper.get("td"));
    assertFalse(scraper.move("td"));

    scraper.scrape(TEST_PAGE + TEST_PAGE);
    assertTrue(scraper.move("td"));
    assertEquals("FOO", scraper.get("td"));
    assertTrue(scraper.move("td"));
    assertEquals("FOO", scraper.get("td"));
    assertFalse(scraper.move("td"));
  }
Пример #3
0
 public void testScrapeTableCell() {
   scraper.move("tr");
   String t = scraper.get("tr");
   HtmlScraper scraper2 = new HtmlScraper();
   scraper2.scrape(t);
   //        HtmlScraper scraper2 = scraper.scrapeTag("tr");
   assertEquals("<td align='center'>FOO</td>", scraper2.toString());
   assertTrue(scraper2.move("td"));
   assertEquals("FOO", scraper2.get("td"));
 }
Пример #4
0
 public void testTmp() {
   HtmlScraper s = new HtmlScraper();
   s.scrape("<td align='center'>FOO</td>");
   assertTrue(s.move("td"));
   assertEquals("FOO", s.get("td"));
 }
Пример #5
0
 public void testSingleQuoteAttributes() {
   assertEquals("center", scraper.get("td[align]"));
 }
Пример #6
0
 public void testScrapeTag() {
   HtmlScraper scraper2 = scraper.scrapeTag("table");
   assertEquals("<tr><td align='center'>FOO</td></tr>", scraper2.toString());
 }
Пример #7
0
 public void testCaseInsensitive() {
   assertEquals("FOO", scraper.get("TD"));
   assertEquals("FOO", scraper.get("Td"));
   assertEquals("FOO", scraper.get("tD"));
   assertEquals("FOO", scraper.get("td"));
 }
Пример #8
0
 public void testCaseInsensitiveAttribute() {
   assertEquals("ffffff", scraper.get("TABLE[bgcolor]"));
   assertEquals("ffffff", scraper.get("TABLE[BGCOLOR]"));
   assertEquals("ffffff", scraper.get("table[BGCOLOR]"));
   assertEquals("ffffff", scraper.get("table[bgcolor]"));
 }
Пример #9
0
 public void testScrapeAttribute() {
   assertEquals("ffffff", scraper.get("table[bgcolor]"));
 }
Пример #10
0
 public void testScrape() {
   assertEquals("FOO", scraper.get("td"));
 }
Пример #11
0
 public void setUp() {
   scraper = new HtmlScraper();
   scraper.scrape(TEST_PAGE);
 }
Пример #12
0
 public void testScrapeTable2() {
   Object[] data = scraper.scrapeTable(new Object[] {String.class});
   assertEquals("FOO", ((Object[]) data[0])[0]);
 }
Пример #13
0
 public void testScrapeTable() {
   Object[] data = scraper.scrapeTable();
   assertEquals("FOO", ((Object[]) data[0])[0]);
 }