1
목록보기에서 항목의 색인을 찾으려고합니다. 색인을 찾으려면이 기능을 사용하고 있습니다.element.all이 해결되기를 기다리는 방법?
function restFunction(appName) {
var indexForItem = 0;
var a = element.all(by.repeater("app in itemList").column("app.itemName")).each(function (element, index) {
element.getText().then(function (name) {
console.log("Name is " + name);
if (name == "sam") {
indexForItem = index + 1;
console.log("Ïndex is " + indexForItem);
a = index;
}
});
});
return a;
}
위의 약속이 어떻게 해결 될 때까지 기다릴 수 있습니까? 지금 내 restFunction을 호출 할 때 나는 항상 보류 상태에있는 약속을 얻는다.