assert_and_parse_html
Parses a string of HTML into a DOM object and raises a test failure with a formatted message if the parsing process encounters an HTMLParseError.
def assert_and_parse_html(
html: string,
user_msg: string,
msg: string
) - > DOM
Attempts to parse a string of HTML into a DOM object, raising a test failure with a formatted message if the HTML is malformed.
Parameters
| Name | Type | Description |
|---|---|---|
| html | string | The raw HTML content to be parsed and validated. |
| user_msg | string | A custom message provided by the user to be included in the failure output if parsing fails. |
| msg | string | The standard error message or context to be displayed alongside the parsing error. |
Returns
| Type | Description |
|---|---|
DOM | The parsed document object model representing the provided HTML string. |