Package rife.test
Class ParsedHtml
java.lang.Object
rife.test.ParsedHtml
Retrieves the text content of a
MockResponse and parses it as HTML.- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionorg.jsoup.nodes.DocumentRetrieves the document that corresponds to the parsed HTML.static StringgetElementAttribute(org.jsoup.nodes.Element element, String attributeName) Retrieves the value of the attribute of an JSoup element.getForms()Retrieves the list of all the forms in the HTML document.getFormWithId(String id) Retrieves the first form in the HTML document with a particularidattribute.getFormWithName(String name) Retrieves the first form in the HTML document with a particularnameattribute.getLinks()Retrieves the list of all the links in the HTML document.getLinkWithId(String id) Retrieves the first link in the HTML document with a particularidattribute.Retrieves the first link in the HTML document that surrounds animgtag with a certainaltattribute.getLinkWithImageName(String name) Retrieves the first link in the HTML document that surrounds animgtag with a certainnameattribute.getLinkWithName(String name) Retrieves the first link in the HTML document with a particularnameattribute.getLinkWithText(String text) Retrieves the first link in the HTML document that surrounds a particular text.getTitle()Retrieves the text of thetitletag.static ParsedHtmlparse(MockResponse response) Parses the text content of aMockResponseobject as HTML and returns the result as an instance ofParsedHtml.
-
Method Details
-
parse
Parses the text content of aMockResponseobject as HTML and returns the result as an instance ofParsedHtml.- Parameters:
response- the response whose text content will be parsed- Returns:
- the resulting instance of
ParsedHtml - Since:
- 1.0
-
getDocument
public org.jsoup.nodes.Document getDocument()Retrieves the document that corresponds to the parsed HTML.- Returns:
- the parsed document
- Since:
- 1.0
-
getTitle
Retrieves the text of thetitletag.- Returns:
- the title
- Since:
- 1.0
-
getForms
Retrieves the list of all the forms in the HTML document.- Returns:
- a list with
MockForminstances - Since:
- 1.0
- See Also:
-
getFormWithName
Retrieves the first form in the HTML document with a particularnameattribute.- Parameters:
name- the content of thenameattribute- Returns:
- the first
MockFormwhosenameattribute matches; ornullif no such form could be found - Since:
- 1.0
- See Also:
-
getFormWithId
Retrieves the first form in the HTML document with a particularidattribute.- Parameters:
id- the content of theidattribute- Returns:
- the first
MockFormwhoseidattribute matches; ornullif no such form could be found - Since:
- 1.0
- See Also:
-
getLinks
Retrieves the list of all the links in the HTML document.- Returns:
- a list with
MockLinkinstances - Since:
- 1.0
- See Also:
-
getLinkWithName
Retrieves the first link in the HTML document with a particularnameattribute.- Parameters:
name- the content of thenameattribute- Returns:
- the first
MockLinkwhosenameattribute matches; ornullif no such link could be found - Since:
- 1.0
- See Also:
-
getLinkWithId
Retrieves the first link in the HTML document with a particularidattribute.- Parameters:
id- the content of theidattribute- Returns:
- the first
MockLinkwhoseidattribute matches; ornullif no such link could be found - Since:
- 1.0
- See Also:
-
getLinkWithText
Retrieves the first link in the HTML document that surrounds a particular text.- Parameters:
text- the surrounded text- Returns:
- the first
MockLinkwhose surrounded text matches; ornullif no such link could be found - Since:
- 1.0
- See Also:
-
getLinkWithImageAlt
Retrieves the first link in the HTML document that surrounds animgtag with a certainaltattribute.- Parameters:
alt- the content of thealtattribute- Returns:
- the first
MockLinkthat has animgtag whosealtattribute matches; ornullif no such link could be found - Since:
- 1.0
- See Also:
-
getLinkWithImageName
Retrieves the first link in the HTML document that surrounds animgtag with a certainnameattribute.- Parameters:
name- the content of thenameattribute- Returns:
- the first
MockLinkthat has animgtag whosenameattribute matches; ornullif no such link could be found - Since:
- 1.0
- See Also:
-
getElementAttribute
Retrieves the value of the attribute of an JSoup element.- Parameters:
element- the element where the attribute should be obtained fromattributeName- the name of the attribute- Returns:
- the value of the attribute; or
nullif no attribute could be found - Since:
- 1.0
-