3
var DrpStack = browser.findElement(by.xpath(XPath))
var Elems = DrpStack.findElements(by.tagName(TagName))
Elems.then(function(list){
for (var i = 0; i < list.length; i++) {
if (list[i].getAttribute("aria-pressed")=='true') {
Labl1.list[i].getAttribute("onlabel");
} else {
console.log("FAIL");
}
}
Q.all(Labl1).done(function (result) {
// Q.All will print the results when the lookups and processing are done
console.log(result.length);
console.log(result);
});
});
這裏我檢查'aria-pressed'的屬性是true還是false。如果該元素被推入數組中,那麼它應該打印爲false。 它不起作用,日誌始終打印失敗。我做錯了什麼。請幫忙。比較元素的屬性
感謝名單伴侶。該承諾工作。 – Ramii