檢查元素的屬性值是否符合正規表達式。

用法

範例

this.demoTest = function (browser) {
  browser.assert.attributeMatches('body', 'data-attr', '(value)');
};

參數

名稱 類型 描述
definition 字串 | 物件

用於定位元素的選擇器 (CSS/Xpath)。可以是字串或指定元素屬性的物件。

attribute 字串

屬性名稱

regexExpression 字串 | RegExp

用於比對屬性值的正規表達式。

msg
選填
字串

顯示在輸出中的選填記錄訊息。如果缺少,則預設會顯示一個。