Skip to content

How do I clear text in an input field

This example demonstrates clearing the value entered in the input field.

In the solution shown below, you will see that the text from the "Age" input field in HICC is being cleared using "clear" command.

Solution:
# Command Target Value
Clearing the text from "Age" input field
1 clear id=txt_age  

Tips, Tricks, Gotchas & Best Practices: 

  • As an alternative, you can use type command also to clear the text and enter a new value.
  • In cases where the clear action would take time, then you can use clearAndWait command.
  • As a best practice, you are encouraged to validate if the value is cleared from the input field using assertValue, verifyValue or waitForValue commands.


Feedback and Knowledge Base