Package com.meterware.httpunit
Interface HTMLSegment
- All Known Implementing Classes:
BlockElement
,TableCell
,TextBlock
,WebResponse
public interface HTMLSegment
Represents the parse tree for a segment of HTML.
- Author:
- Russell Gold
-
Method Summary
Modifier and TypeMethodDescriptionReturns the applets found in the page in the order in which they appear.String[]
Returns a list of HTML element names contained in this HTML section.getElementsWithAttribute
(String name, String value) Returns the HTMLElements found with the specified attribute value.getElementsWithName
(String name) Returns the HTMLElements found in this segment with the specified name.Returns the HTMLElement found in this segment with the specified ID.getFirstMatchingForm
(HTMLElementPredicate predicate, Object value) Returns the first form found in the page matching the specified criteria.getFirstMatchingLink
(HTMLElementPredicate predicate, Object value) Returns the first link found in the page matching the specified criteria.getFirstMatchingTable
(HTMLElementPredicate predicate, Object criteria) Returns the first table in the response which matches the specified predicate and value.WebForm[]
getForms()
Returns the forms found in this HTML segment in the order in which they appear.getFormWithID
(String ID) Returns the form found in this HTML segment with the specified ID.getFormWithName
(String name) Returns the form found in this HTML segment with the specified name.WebImage[]
Returns the images found in the page in the order in which they appear.getImageWithAltText
(String source) Returns the first image found in the page with the specified alt attribute.getImageWithName
(String name) Returns the image found in the page with the specified name.getImageWithSource
(String source) Returns the first image found in the page with the specified src attribute.WebLink[]
getLinks()
Returns the links found in this HTML segment in the order in which they appear.getLinkWith
(String text) Returns the first link which contains the specified text.getLinkWithImageText
(String text) Returns the first link which contains an image with the specified text as its 'alt' attribute.WebForm[]
getMatchingForms
(HTMLElementPredicate predicate, Object criteria) Returns all forms found in the page matching the specified criteria.WebLink[]
getMatchingLinks
(HTMLElementPredicate predicate, Object criteria) Returns all links found in the page matching the specified criteria.WebTable[]
getMatchingTables
(HTMLElementPredicate predicate, Object criteria) Returns all tables found in the page matching the specified criteria.WebTable[]
Returns the top-level tables found in this HTML segment in the order in which they appear.getTableStartingWith
(String text) Returns the first table in this HTML segment which has the specified text as the full text of its first non-blank row and non-blank column.Returns the first table in this HTML segment which has the specified text as a prefix of the text in its first non-blank row and non-blank column.getTableWithID
(String ID) Returns the first table in this HTML segment which has the specified text as its ID attribute.getTableWithSummary
(String summary) Returns the first table in this HTML segment which has the specified text as its summary attribute.Returns the top-level block elements found in the page in the order in which they appear.
-
Method Details
-
getElementWithID
Returns the HTMLElement found in this segment with the specified ID.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getElementsWithName
Returns the HTMLElements found in this segment with the specified name.- Throws:
SAXException
-
getElementsWithAttribute
Returns the HTMLElements found with the specified attribute value.- Throws:
SAXException
- Since:
- 1.6
-
getElementNames
Returns a list of HTML element names contained in this HTML section.- Throws:
SAXException
-
getForms
Returns the forms found in this HTML segment in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getFormWithID
Returns the form found in this HTML segment with the specified ID.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getFormWithName
Returns the form found in this HTML segment with the specified name.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getFirstMatchingForm
Returns the first form found in the page matching the specified criteria.- Throws:
SAXException
- thrown if there is an error parsing the response.
-
getMatchingForms
Returns all forms found in the page matching the specified criteria.- Throws:
SAXException
- thrown if there is an error parsing the response.
-
getLinks
Returns the links found in this HTML segment in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getLinkWith
Returns the first link which contains the specified text.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getLinkWithImageText
Returns the first link which contains an image with the specified text as its 'alt' attribute.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getFirstMatchingLink
Returns the first link found in the page matching the specified criteria.- Throws:
SAXException
- thrown if there is an error parsing the response.
-
getMatchingLinks
Returns all links found in the page matching the specified criteria.- Throws:
SAXException
- thrown if there is an error parsing the response.
-
getImages
Returns the images found in the page in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getImageWithName
Returns the image found in the page with the specified name.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getImageWithSource
Returns the first image found in the page with the specified src attribute.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getImageWithAltText
Returns the first image found in the page with the specified alt attribute.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getApplets
Returns the applets found in the page in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getTextBlocks
Returns the top-level block elements found in the page in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.- Since:
- 1.6
-
getTables
Returns the top-level tables found in this HTML segment in the order in which they appear.- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getFirstMatchingTable
Returns the first table in the response which matches the specified predicate and value. Will recurse into any nested tables, as needed.- Returns:
- the selected table, or null if none is found
- Throws:
SAXException
-
getMatchingTables
Returns all tables found in the page matching the specified criteria.- Throws:
SAXException
- thrown if there is an error parsing the response.
-
getTableStartingWith
Returns the first table in this HTML segment which has the specified text as the full text of its first non-blank row and non-blank column. Will recurse into any nested tables, as needed.- Returns:
- the selected table, or null if none is found
- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getTableStartingWithPrefix
Returns the first table in this HTML segment which has the specified text as a prefix of the text in its first non-blank row and non-blank column. Will recurse into any nested tables, as needed.- Returns:
- the selected table, or null if none is found
- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getTableWithSummary
Returns the first table in this HTML segment which has the specified text as its summary attribute. Will recurse into any nested tables, as needed.- Returns:
- the selected table, or null if none is found
- Throws:
SAXException
- thrown if there is an error parsing the segment.
-
getTableWithID
Returns the first table in this HTML segment which has the specified text as its ID attribute. Will recurse into any nested tables, as needed.- Returns:
- the selected table, or null if none is found
- Throws:
SAXException
- thrown if there is an error parsing the segment.
-