Menu

get HTMLDocument instead if Document ?

2001-08-02
2002-09-11
  • Felix Schmid

    Felix Schmid - 2001-08-02

    Hi,

    the getDOM method of WebResponse returns a Document class. Since the HTMLDocument class provides comfortable methods to find HTML tags it would be nice to work with it instead of the Document class.
      Can anyone tell me how to get a HTMLDocument from a Document?

    regards
    felix

     
    • Russell Gold

      Russell Gold - 2001-08-06

      Unfortunately, the JTidy parser does not create HTMLDocument. This would require the parser to be substantially rewritten.

       
    • Anonymous

      Anonymous - 2002-05-07

      Given this restriction of only being able to manipulate a generic XML Document type, can anyone tell me what is the easiest way (if there is one) of testing for *specific* HTML element types?

      For instance, I would like my test to be able to say "make sure there's 3 checkboxes, two select controls, and make sure they're set to the following values."

      In other words, I don't just want to know that there's "some" parameter called "selectedItem", but that it in fact is an *actual* <select> element, and not some other type of element.

      Is this currently possible with HttpUnit?

      thanks,

      - barry

       
    • Scott Kingdon

      Scott Kingdon - 2002-09-11

      If you just want to know that there are three checkboxes on the page it might be easiest to use response.getText(). You can then parse the page for whatever you want.

      I fount that I like to use the DOM, though. I can then look for specific tags in specific locations. For example this would return the name of some tag burried within a form:

      form.getDOMSubtree().getChildNodes().item(3).getChildNodes().item(i).getFirstChild().getFirstChild().getNodeName();

       

Log in to post a comment.

Auth0 Logo