Clear input fields or editable elements during your test
In real user journeys, users often correct mistakes, reset form fields, or clear existing values before entering new data. The Clear step allows your automated test to remove the current content of an input field or editable element, mimicking this behaviour exactly as a real user would.
This ensures that forms and fields behave correctly when fields are reset and prevents leftover data from interfering with subsequent interactions.
Why clearing fields matters
Many test flows involve entering data into text boxes, search fields, or other input controls. Without a clear action, residual values from previous steps might cause:
Validation errors
Confusion in subsequent input
Incorrect form submission
Unexpected default behaviour
Broken tests due to stale data
Using the Clear step ensures that your test starts fresh before entering new values.
How it works
The Clear step targets a specific form field or editable element and removes its current contents. It behaves just like a user selecting the existing text and deleting it before typing a new value.
Typical scenarios include:
Resetting a field before entering updated information
Clearing a search input before a new query
Preparing a field for a negative test case
Ensuring that values do not persist after navigation
This step is deterministic and precise, making your tests more reliable and easier to maintain.
Works with other form actions
The Clear step is often used alongside other input steps such as:
Fill Input to enter new values
Check Value to validate a field’s current content
Select Option to change dropdown selections
Check Text to confirm error or success messaging
For example, a typical flow might be:
Fill a form field
Assert text or value
Clear the field
Enter a new value
Submit the form
This mirrors how users correct or revise data in real life.
Improve test accuracy and reliability
By explicitly clearing fields, you avoid brittle workarounds like reloading pages or navigating away just to reset state. Instead, your test expresses intent clearly, making it easier to read and maintain.
This also reduces the chance of intermittent failures where an unexpected leftover value causes a step to behave differently.
Using the Clear step helps keep your automation consistent, predictable, and more reflective of true user behaviour.