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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, the JTidy parser does not create HTMLDocument. This would require the parser to be substantially rewritten.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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
Unfortunately, the JTidy parser does not create HTMLDocument. This would require the parser to be substantially rewritten.
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
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();