I have created a function for getting all links and clicking on them and then handle the windows using another method. Everything works fine, but now I want to put a condition that only few links are clicked. So the function is like:
this.getLinks = function(){
browser.driver.findElements(that.links).then(function(foundElements){
var val;
for(var i =0;i<foundElements.length;i++){
browser.sleep(3000);
foundElements[i].getText().then(function(textValue){
val = textValue;
**console.log(val);**
});
if(val != '??????' || val != '?????????' || val != '??????'){
foundElements[i].click();
that.getWindows();
}
}
});
};
I want to get the value of val out of promise so that I can put a condition that only selected links are clicked.
Aucun commentaire:
Enregistrer un commentaire