Get Value or Get Text?

Hi Team,

I am confused about when to Get Value and when to use Get Text during Web Application automation.
Can somebody clarify their usage?


Get value returns value of HTML element as defined in HTML dom.

Get Text returns the the text content from a DOM-element.
For ex:

<input name="Name Locator" value="selenium">Hello</input>

get value will return selenium and getText will return Hello

Typically both will give the same result in case value attribute is not defined explicitly with the difference getValue returns the value held by formatted text field component while getText returns the value’s String representation. It will be differentiable for Date or Number