.assert.hasAttribute() 建議編輯
檢查給定的元素是否包含指定的 DOM 屬性。
等同於:https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
用法
範例
this.demoTest = function (browser) {
browser.assert.hasAttribute('#main', 'data-track');
};
參數
名稱 | 類型 | 描述 |
---|---|---|
definition |
字串 | 物件 | 用來定位元素的選取器 (CSS/Xpath)。可以是字串或物件,用於指定元素屬性。 |
expectedAttribute |
字串 | 要尋找的 DOM 屬性。 |
msg 選填 |
字串 | 選填的日誌訊息,顯示在輸出中。如果遺失,則會預設顯示一個。 |