javascript - How to return text from an element into variable in Protractor -
here's deal - gettext() method returns promise, it's okay in case when using inside of expect(), when i'm trying return string
value of element variable, returns promise. here code:
var text = mainpage.counter().gettext().then((text) => { return text; })
is there way text , assign variable?
a promise’s value resolved promise, should check post : how return response asynchronous call?
so in case -
var data = mainpage.counter().gettext().then((text) => { return text; }); // @ point data still managed promise! data.then((text) => { console.log(text); // text printed! });
Comments
Post a Comment