How to click on a link within a ng-repeat
Hello,
I am having trouble getting to the objects within the below ng-repeat. I need to be able to click on the link "Tremor Nestle Toll House". I have tried different ways to get to that link but have not yet succeeded. So I tried to just click the row like below, which also did not succeed. Can you please help me the protractor code to do so?
Thanks, Divya
var firstRow = ptor.findElement(protractor.By.repeater('col in completeColumns')).row(0);
firstRow.click();
<div class="row ng-scope card-inactive" ng-class="{true: 'card-active', false: 'card-inactive'}[card[recordIdentifier] == activeCard]" ng-repeat="card in cardModel">
<div class="card-content no-card-options" ng-click="openCardDetails($index)" ng-class="{true: 'card-options', false: 'no-card-options'}[card.options.length > 0]">
<ul ng-click="openDetails(card[recordIdentifier])">
<li class="detail-item ng-scope" ng-if="displayCols" ng-repeat="col in completeColumns"></li>
<li class="detail-item ng-scope" ng-if="displayCols" ng-repeat="col in completeColumns">
<ul>
<li class="detail-content ng-binding">
Tremor Nestle Toll House
</li>
<li class="detail-name ng-binding">
Name
</li>
</ul>
</li>
<li class="detail-item ng-scope" ng-if="displayCols" ng-repeat="col in completeColumns"></li>
<li class="detail-item ng-scope" ng-if="displayCols" ng-repeat="col in completeColumns"></li>
</ul>
</div>
Try this, element.all(by.repeater('(col in completeColumns')).then(function(completeColumns) { completeColumns[1].click(); });
Or alternatively you can try this too - element(by.buttonText('Tremor Nestle Toll House')).click(); Or element(by.linkText("Tremor Nestle Toll House")).click();
Thanks smahalingam!! Your first suggestion worked.
Divya
Glad it worked