Package org.htmlparser.scanners

Examples of org.htmlparser.scanners.FormScanner


        addScanner(new JspScanner("-j"));
        addScanner(new AppletScanner("-a"));
        addScanner(new MetaTagScanner("-m"));
        addScanner(new TitleScanner("-T"));
        addScanner(new DoctypeScanner("-d"));
        addScanner(new FormScanner("-f", this));
        addScanner(new FrameSetScanner("-r"));
        addScanner(linkScanner.createBaseHREFScanner("-b"));
        addScanner(new BulletListScanner("-bulletList", this));
        //  addScanner(new SpanScanner("-p"));
        addScanner(new DivScanner("-div"));
View Full Code Here


  }

  public void testSearchFor() throws ParserException {
    createParser(FormScannerTest.FORM_HTML);

    parser.addScanner(new FormScanner(parser));
    parseAndAssertNodeCount(1);
    assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
    FormTag formTag = (FormTag) node[0];
    NodeList nodeList = formTag.searchFor("USER NAME");
    assertEquals("Should have found nodes", 1, nodeList.size());
View Full Code Here

  }

  public void testSearchByName() throws ParserException {
    createParser(FormScannerTest.FORM_HTML);

    parser.addScanner(new FormScanner(parser));
    parseAndAssertNodeCount(1);
    assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
    FormTag formTag = (FormTag) node[0];

    Tag tag = formTag.searchByName("passwd");
View Full Code Here

    addScanner(new JspScanner("-j"));
    addScanner(new AppletScanner("-a"));
    addScanner(new MetaTagScanner("-m"));
    addScanner(new TitleScanner("-T"));
    addScanner(new DoctypeScanner("-d"));
    addScanner(new FormScanner("-f", this));
    addScanner(new FrameSetScanner("-r"));
    addScanner(linkScanner.createBaseHREFScanner("-b"));
    addScanner(new BulletListScanner("-bulletList", this));
    // addScanner(new SpanScanner("-p"));
    addScanner(new DivScanner("-div"));
View Full Code Here

  }

  public void testRemoveScanner() throws Exception {
    createParser("");
    parser.registerScanners();
    parser.removeScanner(new FormScanner("", parser));
    Map scanners = parser.getScanners();
    TagScanner scanner = (TagScanner) scanners.get("FORM");
    assertNull("shouldnt have found scanner", scanner);
  }
View Full Code Here

  public void testEvaluate() {
    String line1 = "form method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form";
    String line2 = "FORM method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form";
    String line3 = "Form method=\"post\" onsubmit=\"return implementsearch()\" name=frmsearch id=form";
    FormScanner formScanner = new FormScanner("", Parser.createParser(""));
    assertTrue("Line 1", formScanner.evaluate(line1, null));
    assertTrue("Line 2", formScanner.evaluate(line2, null));
    assertTrue("Line 3", formScanner.evaluate(line3, null));
  }
View Full Code Here

    assertEquals(description + " value", value, inputTag.getAttribute("VALUE"));
  }

  public void testScan() throws ParserException {
    createParser(FORM_HTML, "http://www.google.com/test/index.html");
    parser.addScanner(new FormScanner("", parser));
    parseAndAssertNodeCount(1);
    assertTrue("Node 0 should be Form Tag", node[0] instanceof FormTag);
    FormTag formTag = (FormTag) node[0];
    assertStringEquals("Method", FormTag.POST, formTag.getFormMethod());
    assertStringEquals("Location", "http://www.google.com/test/do_login.php", formTag.getFormLocation());
View Full Code Here

            + "<TR><TD ALIGN=\"center\"><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Login\"></TD></TR>\n"
            + "<TR><TD ALIGN=\"center\">&nbsp;</TD></TR>\n"
            + "<INPUT TYPE=\"hidden\" NAME=\"password\" SIZE=\"20\">\n" + "</TABLE>",
        "http://www.google.com/test/index.html");

    parser.addScanner(new FormScanner("", parser));

    parseAndAssertNodeCount(2);
  }
View Full Code Here

        + "submit value=\"I'm Feeling Lucky\" name=btnI></td><td valign=top nowrap><font size=-2>"
        + "&nbsp;&#8226;&nbsp;<a href=/advanced_search?hl=en>Advanced&nbsp;Search</a><br>&nbsp;&#8226;"
        + "&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&#8226;&nbsp;<a href=/"
        + "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>");

    parser.addScanner(new FormScanner("", parser));
    parser.addScanner(new LinkScanner());
    parseAndAssertNodeCount(1);
    assertTrue("Should be a HTMLFormTag", node[0] instanceof FormTag);
    FormTag formTag = (FormTag) node[0];
    LinkTag[] linkTag = new LinkTag[10];
View Full Code Here

        + "submit value=\"I'm Feeling Lucky\" name=btnI></td><td valign=top nowrap><font size=-2>"
        + "&nbsp;&#8226;&nbsp;<a href=/advanced_search?hl=en>Advanced&nbsp;Search</a><br>&nbsp;&#8226;"
        + "&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&#8226;&nbsp;<a href=/"
        + "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>");

    parser.addScanner(new FormScanner("", parser));
    parseAndAssertNodeCount(1);
    assertTrue("Should be a HTMLFormTag", node[0] instanceof FormTag);
    FormTag formTag = (FormTag) node[0];
    RemarkNode[] remarkNode = new RemarkNode[10];
    int i = 0;
View Full Code Here

TOP

Related Classes of org.htmlparser.scanners.FormScanner

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.