I want to select specific element from a table by the second column value (I removed the whitespaces that where rendered), and after that element is found I want to click on it (the return is true). I've tried this, but it doesn't click on it, but just finds the element.
The html code for that field I want to select is below:
<table ng-table="tableParams" id="Panel" class="tbl-option-list" template-pagination="directives/controls/Pager/Pager.html">
<caption translate>Orders</caption>
<tr id="Panel">
<!-- 1 -->
<th class="fixed-width-glyphicon"></th>
<!-- 2 -->
<th translate>Identifier</th>
</tr>
<tr ng-repeat="item in $data track by $index" ng-class="{'active-bg': order.$selected}" ng-click="changeSelection(order, getRowActions(order))">
<!-- 1 -->
<td class="fixed-width-glyphicon">
<div class="fixed-width-glyphicon">
{{item.priority.toUpperCase()[0]}}
</div>
</td>
<!-- 2 -->
<td>{{item.identifierCode}}</td>
</tr>
</table>
The select command from protractor is:
var deferred = protractorData.p.promise.defer();
element.all(by.repeater('item in $data track by $index')).filter(function(row) {
row.getText().then(function(txt) {
txt = txt.replace(/\s/g, '');
var found = txt.split('ID0001');
return found.length > 1;
});
}).then(function(elem) {
deferred.fulfill(elem[0]);
});
return deferred.promise;
}
I received the following error:
TypeError: Cannot call method 'click' of undefined.