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.
If the result value is JSON object or array, a deep equality comparison will be performed.

Usage

Example

this.demoTest = function (browser) {
  browser.assert.domPropertyEquals('#main', 'className', 'visible');

  // deep equal will be performed
  browser.assert.domPropertyEquals('#main', 'classList', ['class-one', 'class-two']);

  // split on ',' and deep equal will be performed
  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.