These examples show how to access DOM element's properties and verify them with assertions.
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.