Need to find the count of the element from arryelement and if the count>1 then need to click
/*search name is clinic name
clinicsearch is the arrayelement which has the list of clinic name list from the table*/
public SearchAndSelectClinicA(SearchName:string){
this.ClinicSearch.sendKeys(SearchName);
this.SearchIcon.click(); //click on the icon to get the clinic names
this.SearchedClinic.count().then(function(count){
//get the count of elements which are there in the Searchedclinic element array
if(count>1){
this.SearchedClinic.each(function(rows){
/*Failed: Cannot read property 'SearchedClinic' of undefined
(Error gets displayed when it comes to above line.*/
rows.getText().then(function(value){
if(value.indexOf(SearchName)){
//Click the element if the statement is satisfied
rows.click();
}
});
});
}
});
}
Please help me in solving this
Failed: Cannot read property 'SearchedClinic' of undefined.
Is getting displayed.
It is able to execute till the if statement. Later it throws error as specifief above and the exection stops immediately