How do I enter text in an input field
This example demonstrates entering a text in the input field.
In the solution shown below, you will see that the age is entered in the "Age" input field in
HICC application using "type" command.
Solution:
# | Command | Target | Value |
---|---|---|---|
Enter text in the "Age" input field | |||
1 | type | id=txt_age | 45 |
Tips, Tricks, Gotchas & Best Practices:
- As an alternative to "type" command, you can use sendKeys, sendKeysEnter, sendKeysTabOut commands, in cases where the execution results are not as expected.
- When you use "type" command, it clears the input field and then enters the text. Whereas, commands like "sendKeys", "sendKeysEnter", "sendKeysTabOut" do not clear the input field, instead they append the text to the existing value. In this case, use the clear command along with these commands.
- As a best practice, you are encouraged to validate the value entered in the input field using assertValue, verifyValue or waitForValue commands.