I have a function which returns a value:
checkValue = function(Name){
var tempIndex=-1;
var nameIndex=0;
return selectElement.all(by.tagName('option')).each(function (element) {
return element.getText().then(function(text){
tempIndex++;
if(text.toString().indexOf(Name)!=-1){
nameIndex=tempIndex;
return nameIndex;
}else{
return nameIndex;
};
});
});
This is called in another function:
checkValue(Name).then(function(value){
logger.info("value ::"+value);
});
When I call the above function the value is displayed as undefined, and in the logs it gets displayed before the checkValue
is called.
Any suggestions?