Still fairly new to Protractor. I'm trying to set the variable text but it returns the empty string. Explanations and fixes are greatly appreciated!
I tried debugging by adding "listname " to be printed to the console. It works fine but the text is not printed to the console.
var listname = "";
selectList()
.first()
.element(by.css('.listname'))
.getText()
.then(function(text) {
listname = text;
console.log(listname);
});
console.log("listname " + listname);
From my understanding, I know that this should be asynchronous, but I thought the promise is fulfilled by the .then . Afterwards I should be able to retrieve the text.
The return output is:
listname
List1
Whereas I expect:
List1
listname List1