Get data from input field or from textarea

In certain situations we need to get data from input field or from textarea.

The selenium getText() function is not good to get the data from input filed (<input>) or from textarea (<textarea>).

driver.findElement(By.xpath(TEXTAREA.XPATH)).getText()returns an empty string.

The solution is to use getAttribute(“value”).


Posted By István Lackó

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>