Checks if the given element contains the specified DOM attribute.

Equivalent of: https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute

Usage

Example

this.demoTest = function (browser) {
  browser.assert.hasAttribute('#main', 'data-track');
};

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.

expectedAttribute string

The DOM attribute to look for.

msg
Optional
string

Optional log message to display in the output. If missing, one is displayed by default.