Package org.htmlparser.tags

Examples of org.htmlparser.tags.InputTag


                  FormTag form = (FormTag) ni.nextNode();
                  String fragment = "action:"+form.getAttribute("action")+" method:"+form.getAttribute("method");
                  _model.addFragment(url, id, FragmentsModel.KEY_FORMS,fragment );
                }
                for (NodeIterator ni = inputs.elements(); ni.hasMoreNodes(); ) {
                  InputTag tag = (InputTag) ni.nextNode();
                  String type = tag.getAttribute("type");
                  if( "hidden".equals(type))
                  {
                    String fragment = tag.toHtml();
                    _model.addFragment(url, id, FragmentsModel.KEY_HIDDENFIELD, fragment);
                  }
                  if("file".equals(type))
                  {
                    String fragment = tag.toHtml();
                    _model.addFragment(url, id, FragmentsModel.KEY_FILEUPLOAD, fragment);
                  }
                }
            } catch (ParserException pe) {
                _logger.warning("Looking for fragments, got '" + pe + "'");
View Full Code Here


        registerTag (new FormTag ());
        registerTag (new FrameSetTag ());
        registerTag (new FrameTag ());
        registerTag (new HeadingTag ());
        registerTag (new ImageTag ());
        registerTag (new InputTag ());
        registerTag (new JspTag ());
        registerTag (new LabelTag ());
        registerTag (new LinkTag ());
        registerTag (new MetaTag ());
        registerTag (new ObjectTag ());
View Full Code Here

                );
        }
    }

    protected void assertHiddenIDTagPresent(FormTag formTag, String name, String inputTagValue) {
        InputTag inputTag = formTag.getInputTag(name);
        assertNotNull("Hidden Tag "+name+" should have been there", inputTag);
        assertStringEquals("Hidden Tag Contents", inputTagValue, inputTag.getAttribute("VALUE"));
        assertStringEquals("Hidden Tag Type", "hidden", inputTag.getAttribute("TYPE"));
    }
View Full Code Here

        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());
        assertStringEquals("Name","login_form",formTag.getFormName());
        InputTag nameTag = formTag.getInputTag("name");
        InputTag passwdTag = formTag.getInputTag("passwd");
        InputTag submitTag = formTag.getInputTag("submit");
        InputTag dummyTag = formTag.getInputTag("dummy");
        assertNotNull("Input Name Tag should not be null",nameTag);
        assertNotNull("Input Password Tag should not be null",passwdTag);
        assertNotNull("Input Submit Tag should not be null",submitTag);
        assertNull("Input dummy tag should be null",dummyTag);
View Full Code Here

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
                    new SelectTag (),
                    new OptionTag (),
                }));
View Full Code Here

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
                    new SelectTag (),
                    new OptionTag (),
                    new LinkTag (),
                    new TableTag (),
View Full Code Here

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
                    new SelectTag (),
                    new OptionTag (),
                    new TableTag (),
                }));
View Full Code Here

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
                    new SelectTag (),
                    new OptionTag (),
                }));
        parseAndAssertNodeCount(1);
View Full Code Here

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
                    new SelectTag (),
                    new OptionTag (),
                }));
        parseAndAssertNodeCount(1);
View Full Code Here

     */
    public void testTextArea () throws Exception
    {
        FormTag formTag;
        NodeList nl;
        InputTag inpTag;
        TextareaTag texTag;
       
        String html = "<body onload=\"otextnloadHandler()\" onunload=\"closeAdvanced()\">\n" +
            "  <form name=\"searchForm\" onsubmit=\"doSearch()\">\n" +
            "    <table id=\"searchTable\" align=\"left\" valign=\"middle\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n" +
            "      <tbody><tr nowrap=\"\" valign=\"middle\">\n" +
            "        <td id=\"searchTD\">\n" +
            "          <label id=\"searchLabel\" for=\"searchWord\">\n" +
            "           Search:\n" +
            "          </label>\n" +
            "        </td>\n" +
            "\n" +
            "        <td>\n" +
            "          <input type=\"text\" id=\"searchWord\" name=\"searchWord\" value=\"\" size=\"24\" maxlength=\"256\" alt=\"Search Expression\">\n" +
            "        </td>\n" +
            // note: this was added as there weren't any textarea tags in the page referenced
            "        <td>\n" +
            "          <textarea name=\"mytextarea\" rows=\"1\" cols=\"12\" alt=\"Free Form Text\">\n" +
            "             The text.\n" +
            "          </textarea>\n" +
            "        </td>\n" +
            "        <td>\n" +
            "           <input type=\"button\" onclick=\"this.blur();doSearch()\" value=\"GO\" id=\"go\" alt=\"GO\">\n" +
            "          <input type=\"hidden\" name=\"maxHits\" value=\"500\">\n" +
            "        </td>\n" +
            "        <td nowrap=\"nowrap\">\n" +
            "\n" +
            "          <a id=\"scopeLabel\" href=\"javascript:openAdvanced();\" title=\"Search only the following topics\" alt=\"Search only the following topics\" onmouseover=\"window.status='Search only the following topics'; return true;\" onmouseout=\"window.status='';\">Search scope:</a>\n" +
            "        </td>\n" +
            "        <td nowrap=\"nowrap\">\n" +
            "          <input type=\"hidden\" name=\"workingSet\" value=\"All topics\">\n" +
            "          <div id=\"scope\">All topics</div>\n" +
            "        </td>\n" +
            "      </tr>\n" +
            "\n" +
            "    </tbody></table>\n" +
            "  </form>\n" +
            "\n" +
            "</body>\n";
        createParser (html);
        formTag =
            (FormTag)(parser.extractAllNodesThatMatch (new NodeClassFilter (
                FormTag.class
            )).elementAt (0));
        assertNotNull ("Should have found a form tag",formTag);
        assertStringEquals ("name", "searchForm", formTag.getFormName ());
        nl = formTag.getFormInputs ();
        assertTrue ("4 inputs", 4 == nl.size ());
        inpTag = (InputTag)nl.elementAt (0);
        assertStringEquals ("name", "searchWord", inpTag.getAttribute ("name"));
        assertStringEquals ("value", "", inpTag.getAttribute ("value"));
        inpTag = (InputTag)nl.elementAt (1);
        assertNull ("name", inpTag.getAttribute ("name"));
        assertStringEquals ("value", "GO", inpTag.getAttribute ("value"));
        inpTag = (InputTag)nl.elementAt (2);
        assertStringEquals ("name", "maxHits", inpTag.getAttribute ("name"));
        assertStringEquals ("value", "500", inpTag.getAttribute ("value"));
        inpTag = (InputTag)nl.elementAt (3);
        assertStringEquals ("name", "workingSet", inpTag.getAttribute ("name"));
        assertStringEquals ("value", "All topics", inpTag.getAttribute ("value"));
        nl = formTag.getFormTextareas ();
        assertTrue ("1 textarea", 1 == nl.size ());
        texTag = (TextareaTag)nl.elementAt (0);
        assertStringEquals ("name", "mytextarea", texTag.getAttribute ("name"));
        assertTrue ("only 1 child", 1 == texTag.getChildCount ());
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.InputTag

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.