.assert.domPropertyContains() Suggest edits
Checks if the specified DOM property of a given element has the expected value. For all the available DOM element properties, consult the Element doc at MDN.
Several properties can be specified (either as an array or command-separated list). Nightwatch will check each one for presence.
Usage
Example
this.demoTest = function (browser) {
browser.assert.domPropertyContains('#main', 'classList', 'visible');
// in case the resulting property is an array, several elements could be specified
browser.assert.domPropertyEquals('#main', 'classList', ['class-one', 'class-two']);
browser.assert.domPropertyEquals('#main', 'classList', 'class-one,class-two');
};
Parameters
Name | Type | description |
---|---|---|
definition |
string | object | The selector (CSS/Xpath) used to locate the element. Can either be a string or an object which specifies element properties. |
domProperty |
string | The DOM property name. |
expected |
string | The expected value of the DOM property to check. |
msg Optional |
string | Optional log message to display in the output. If missing, one is displayed by default. |