要素の指定されたDOMプロパティが期待値と一致するかどうかを確認します。利用可能なすべてのDOM要素プロパティについては、MDNの要素ドキュメントを参照してください。

使用方法

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');
};

パラメータ

名前 タイプ 説明
property string

プロパティ名

message
オプション
string

出力に表示するログメッセージ(オプション)。省略した場合、デフォルトのメッセージが表示されます。