Checks if a given DOM property of an element has the expected value. For all the available DOM element properties, consult the Element doc at MDN.

Usage

Example

this.demoTest = function (browser) {
  browser.expect.element('body').to.have.property('className').equals('test-class');
  browser.expect.element('body').to.have.property('className').matches(/^something\ else/);
  browser.expect.element('body').to.not.have.property('classList').equals('test-class');
  browser.expect.element('body').to.have.property('classList').deep.equal(['class-one', 'class-two']);
  browser.expect.element('body').to.have.property('classList').contain('class-two');
  browser.expect.element('body').to.have.domProperty('classList').contain('class-two');
};

Parameters

Name Type description
property string

The property name

message
Optional
string

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