automation - select a record from a list-box using text in Protractor -


i want select record list box using text. how can use filter function select particular record. having many options want select value want checking text (e.g spanish). dont want select value index becoz if wont able verify test, list gets updated. kindly help. below r html code.

 <ul class="addlist">     <li ng-repeat="skill in availableskills" ng-click="addskillfunc(skill, $index)" class="ng-binding ng-scope">mandarin</li> <li ng-repeat="skill in availableskills" ng-click="addskillfunc(skill, $index)" class="ng-binding ng-scope">english</li> <li ng-repeat="skill in availableskills" ng-click="addskillfunc(skill, $index)" class="ng-binding ng-scope">spanish</li> </ul> 

yea can select record index. want selectbyvisibletext available in selenium.

finally got solution. created function selectrowbycellvalue , used call ever want

selectrowbycellvalue(agp.skilllist, data.skillselect);  

skilllist = element.all(by.css('ul.addlist li')); skillselect = value u want select. (spanish)

this.selectrowbycellvalue = function (elem, texts) {   elem.filter(function (element) {  return element.gettext().then(function (text) {  if (text == texts) {  element.click();  return false;  }    }); }).then(function (filteredelements) {   }); }; 

Comments