Skip to content

Latest commit

 

History

History
 
 

element-properties

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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.