Given a todo app that has a list of tasks: Walk the dog, Eat lunch, Go shopping. Each task has a 'complete' link.
Using Protractor, how do I click the complete link for the second task 'Eat lunch'? Preferably I'd like to do this without using indices in my test.
The html structure is like so...
<ul class="pending">
<li ng-repeat="task in tasks">
{{task.name}}
<a href='#'>Complete</a>
</li>
</ul>
This seems like a common situation so surely there has to be a simple solution that I'm overlooking. Thanks in advance
element.all(by.repeater('task in tasks')).
get(1).
element(by.linkText('Complete')).
click()
or
element.all(by.repeater('task in tasks')).
get(1).
$('a').
click()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With