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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -