Skip to content

Latest commit

 

History

History
13 lines (7 loc) · 1.33 KB

File metadata and controls

13 lines (7 loc) · 1.33 KB

Access Element Properties

These examples show how to access DOM element's properties and verify them with assertions.

Check element's markup

Test Code: check-element-markup.js

TestCafe selectors expose API that allows you to access common DOM element properties. To obtain any other property value in test code, you will need to add a custom property to the selector.

This example shows how to access and verify the Element.outerHTML property value that contains HTML markup for the element and its descendants.

In test code, the Selector function creates a regular selector for the label[for] element. The selector.addCustomDOMProperties method then adds the outerHTML property to this selector. The markup obtained from this property is verified with the eql assertion.