Menu

Forms not found with NekoHTML

2002-12-09
2002-12-16
  • Beth Schweinsberg

    I recently upgraded from 1.4.1 to 1.5 and have been trying to "update" my test programs.  With 1.4.1, JTidy was able to identify two forms that I need to test.  However, NekoHTML cannot find them.  None of the Html has changed since I upgraded.  As a test I fetched all of the links on the page and the forms came up there.  It is all quite strange.  Here is what the start of the forms looks like:

    <td>
    <form name="login" action="https://www.mysite.com/register" method="post">
        <input type='hidden' name='yo' value='mama'>
                <img src="/images/bob.gif"><br>
           
                <br>Member ID<br>
                <INPUT TYPE="text" NAME="memberID">
                <br>Password<br>
                <INPUT TYPE="password" NAME="password">
                <br>
    <A href="https://www.mysite.com/forgotPassword">Forgot your password?</a></span>
                <br>
                <a href="javascript:document.login.submit()"><img src="/images/buttons/login.gif"></form>
    </td>

    I have two questions:
    1) Why is Neko not seeing the forms as forms?
    2) How do I use JTidy instead?  I tried deleting Neko from my classpath and only having JTidy there, but it threw an exception about Neko not being there.

    Thank you.

    Beth

     
    • Troy Waldrep

      Troy Waldrep - 2002-12-15

      Strange.  I've actually had better luck with NekoHTML embedded than with JTidy.  One difference might be that I've upgraded to NekoHTML 0.7.1 locally (better tag balancing algorithm).

      One problem might be with the way you are trying to locate the forms.  If you are using the methods provided by httpunit, then you should find them.  However if you're searching through the DOM tree directly, then you might have a problem.  NekoHTML uses Xerces underneath the covers.  Xerces forces the underlying tag names of the DOM tree to be capitalized based on the HTML 3.x/4.x specifications, regardless of the original case in the source.

       
      • Beth Schweinsberg

        No, I'm using WebResponse.getForms() to get the all forms available on the page.

        Oh, and the action form doesn't actually end with a ";", I mistyped that.

        I'll try a newer version of NekoHtml to see if that changes anything.  Thanks.

         
    • Troy Waldrep

      Troy Waldrep - 2002-12-16

      If the problem persists, there is something you might try.

      Use WebResponse.getDOM() to get a copy of the Xerces DOM tree produced by NekoHTML and then recurse down the children nodes in order to ensure that the Form is actually there.  Remember that the Xerces Form element is a real org.w3c.dom.html.HTMLFormElement (with element name "FORM") instead of a org.w3c.dom.Element like JTidy produces.  If you find it in the DOM tree, then the poblem isn't NekoHTML, but instead HttpUnit.  I haven't run into an instance yet where NekoHTML drops elements from the resulting tree.

      regards,

      Troy

       

Log in to post a comment.

Auth0 Logo