Skip to main content
Skip table of contents

getElementsByClass

A logic command that scans through an HTML document and finds elements that have the specified value within their class attribute value.

For each found element, a Map is created that contains an entry for every attribute on the element as well as an entry with the key "bodyText" that contains all text the element and its descendants contain. These Maps are then placed into the variable context in a Collection.

Required Attributes

var

Type: String

Defines the name of the variable that will have the List of element data Maps as its value.

value

Type: File, DAP Part, String

Defines the HTML content this command will be inspecting. The resolved value may be an HTML File, a DAP Part containing HTML, or a String of HTML.

class

Type: String

Defines the class attribute value this command will be looking for. The resolved value may specify only one class.

Use this command to get attributes or text content of elements of any HTML content the logic has access to, such as a composed HTML template document. For example, if this documentation page was in the variable "docPage", the following command...

CODE
<getElementsByClass var="exampleElements" value="${docPage}" class="dyn-logic-cmd-example">

.…would produce a Collection with a single Map in it, representing the element that is this example section. So, an expression exampleElements[0].bodyText would resolve into this example text.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.