Get value from an input element

I.getValue

Get the value of an input element

Usage

I.getValue(target)

Parameters

ParameterTypeRemarks
targetstring

Keyword to identify the field.
The associated label, aria-label, placeholder, adjacent text, and current value can be used to identify a field.
CSS selectors can also be used, but is not recommended as it makes the tests harder to keep up to date.

Example(s)

I.fill("Search", "Hello")
I.type(" from the other side") 
var foo = I.getValue("Search") // `foo` would be "Hello from the other side"

In this example, we first fill "Hello" to the "Search" field, and continue typing " from the other side" into the field which is currently in focus. You can get the value of the "Search" field using I.getValue and store the value into a variable for later use.


Last Updated: