I have an application who has text fields (not select, not checkbox or other types) where an user can enter some value, like this:
ISBN and E-Mail are the label of each input.
Now I have to automatically test these inputs according to their label. The question is: how to recognize that, for example, the first input requires an ISBN code? I programmed something like this:
turn the label value to lowercase
check if the label value contains isbn
if so set the field value to a random ISBN code (i.e.: 1234567890), else set it to a random value (default)
For the email field:
turn the label value to lowercase
check if the label value contains e-mail or email or mail
if so set the field value to a random email (i.e.:
[email protected]), else set it to a random value (default)
And so on for each text field I encounter.
Is that reliable? How can I improve the "recognizing part"? I know only the label value and the field value (what is already written in the field by default) for each text input.