I need to access data outside from then.
function getText() {
cy.get('#locator')
.then(function($elem) {
let aaa = cy.log($elem.text());
return aaa.toString();
});
}
var returnedValue = getText();
cy.log(returnedValue);
I get the error: Argument of type 'void' is not assignable to parameter of type 'string', when I try to print the output in the Cypress test runner log.