Styrow.dev
Question 25 of 36

How to get text from a textbox in Protractor?

Question

How to get text from a textbox in Protractor?

Answer

By using getAttribute method by passing argument as value. getAttribute() method returns a promise which contains String

Syntax:

element(by.xpath(""text box xpath"").getAttribute(""value"")).then(function(textValue){ console.log(textValue) });