我需要根据同一行中该按钮的其他相关值,依次单击按钮。 需要点击: 按钮ng-if =" ctrl.showEdit" 基于文字包含' abc'在以下td或类 class =" width-25 ng-binding" 以上两个属性都在同一行
this.EditByName = function (input) {
element.all(by.className('table pagination-table-margin ng-scope ng-table')).then(function (rows) {
rows.forEach(function (row) {
row.all(by.className('ng-binding')).then(function (columns) {
element.all(by.cssContainingText(input)).then(function () {
element(by.className('btn-grid ng-scope')).click();
console.log(input);
});
});
});
});
};
答案 0 :(得分:0)
您需要使用XPATH选择器,因此您可以在找到具有要用作参考的值的列后回溯,如下所示:
element(by.cssContainingText("td", "abc"))
.element(by.xpath("..")) // This selects the parent <tr>
.all(by.css("button[ng-if='ctr.showEdit']"))