Skip to content

I.clear()

Clears any existing value from a text input field.

This is the same as using I.fill(element, "").

INFO

This command uses the same targeting mechanism as the I.fill() command.

Usage

js
I.clear(element: string)

Parameters

ParameterTypeDescription
elementstringElement to clear — by text, CSS selector, or XPath.

Example

js
I.clear("Email")                // using visible text
I.clear(".email-input")         // using css
I.clear("input[@type='email']") // using xpath

This command clears the value of the "Email" input field.