Answer the question
In order to leave comments, you need to log in
How to select an element through Protractor Angular?
Friends, I just started to study writing tests, I ran into the problem of selecting elements.
For example, there is a button, how to select it from the protractor?
Add an id to each element of the page, to write tests, or what?
Is there more advanced documentation than this UPDATE:
Made a custom element lookup<a ng-click="vm.showMore()">Загрузить ещё</a>
by.addLocator('aText',
function(buttonText, opt_parentElement, opt_rootSelector) {
var using = opt_parentElement || document,
a = using.querySelectorAll('a');
return Array.prototype.filter.call(a, function(a) {
return a.textContent === a;
});
});
// использование
element(by.aText('Загрузить ещё')).click();
Answer the question
In order to leave comments, you need to log in
angular.github.io/protractor/#/locatorsby.css('a[ng-click="vm.showMore()"]');
for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question