How do I validate the value in an input field
This example demonstrates validating the value in an input field.
In the solution shown below, you will see that the value in the "Age" input field in
HICC is validated using "assertValue" command. If the command fails and the entire execution will stop.
Solution:
# | Command | Target | Value |
---|---|---|---|
Validate the age is entered successfully | |||
1 | assertValue | id=txt_age | 45 |
Tips, Tricks, Gotchas & Best Practices:
- If a part of the text changes dynamically, '*' can be used in place of the that text.
- In order to validate the value in an input field, there are other commands that can be used like
- verifyValue - This command validates the value in the input field but unlike "assertValue" command, execution will not stop if the command fails. Hence we recommend to use this command to continue execution with other instructions
- waitForValue - When there is a page loading in the application, you can use this command to wait for the value to be populated into the input field and validate. Also the execution continues with other instructions even if there is a failure.