Protractor: element.getText() returns an object and not String
getText()
returns a promise, you need to resolve it:
page.clientRowName.getText().then(function (text) {
console.log(text);
});
Or, if you just want to assert the text, let expect()
resolve the promise for you:
expect(page.clientRowName.getText()).toEqual("ABC");
Promises and the Control Flow documentation page should clear things up.
Another solution may be to use async/await
.
class Page {
constructor() {
this.clientRowName = $('#CLIENT_NAME');
}
}
/****************/
it('should console.log client name', async () => {
const client = await Page.clientRowName.getText();
console.log(client);
});