Я пытаюсь получить доступ к метке, содержащейся в строке.
Этот код работает, однако он находит все метки этого типа вместо одной в определенной / родительской строке:
expect(element(by.xpath("//span[@ng-click='location.viewAudit(audit)'][contains(@class, 'source-name')]")).isPresent()); //label for the source name
Это код для меня:
var tableRow = element(by.xpath("//tr[contains(@class, 'ng-scope')][@ng-repeat='audit in location.displayedProfileAudits']")).getWebElement();
expect(tableRow.element(by.xpath("//span[@ng-click='location.viewAudit(audit)'][contains(@class, 'source-name')]")).isPresent()); //label for the source name
и возвращаемая ошибка:
Message: TypeError: tableRow.element is not a function
Определение шага полностью:
Then('I should see that a location audit source row has a label for the source', function (callback) {
browser.wait(EC.visibilityOf(listingsPageObj.locationProfileListViewContainer), timeouts.EC_TIMEOUT).then(() => {
browser.wait(EC.visibilityOf(listingsPageObj.locationProfileListViewTable), timeouts.EC_TIMEOUT).then(() => {
browser.wait(() => {
return listingsPageObj.locationProfileListViewTableHeaders.count().then(cnt => (cnt > 0)); //which means that there are audit results displayed
}).then(() => {
//find a row in the list of displayed audits
var tableRow = element(by.xpath("//tr[contains(@class, 'ng-scope')][@ng-repeat='audit in location.displayedProfileAudits']")).getWebElement();
//then verify, within that row, there is a label for the source name
expect(tableRow.element(by.xpath("//span[@ng-click='location.viewAudit(audit)'][contains(@class, 'source-name')]")).isPresent()); //label for the source name
callback();
});
});
});
});