HtmlElementAuditor checks for the presence of a specified HTML element. If the HTML element is found at least once, the audit passes, otherwise the audit fails. This auditor can be applied to any renderable node. The auditor uses jsoup queries to parse and find HTML elements. These queries have a jQuery or CSS like syntax.
In addition to the common auditor properties, this auditor can be configured with the following properties:
Determines how a failed audit will be counted:
Defines the property name for storing failed audit results.
The property name should be unique among auditors or auditors may overwrite results.
Defines a message or explanation for a failed audit.
The message can have placeholders that are replaced with information about the node and auditor:
A valid jsoup query. See this cookbook for more on jsoup queries.
Added in v5.6.2
Defines the content fetcher for the selected node. The query is then applied to the fetched content.
There are two types of content fetchers available, for more about content fetchers, see: Content Fetchers.
If defined, this pattern will be applied to the returned results of the jsoup query. If the pattern does not match a result, then an audit result of
Added in v5.6.5
Regular expression bit flags for matching. The flags will be applied with any regular expression defined by
The valueFlags value should correspond to the match flags defined in
optional, required if valuePattern is defined
Defines a message or explanation if a query result does not match
The message can have placeholders that replaced with:
Added in v5.6.5
Controls the text searched by valuePattern.
If set to true, the text will be stripped of all HTML tags and only the the values of HTML tags will be used.
If set to false (the default), the full text including all HTML tags, will be searched.
Here is an example from the SEO module. You can find this configuration here: