PennController for IBEX › Forums › Support › Filled TextInput › Reply To: Filled TextInput
May 4, 2020 at 4:36 pm
#5194

Keymaster
Hello,
Yes, you can use .test.text to check the content of a TextInput element, and doing so in the wait command will only validate the click if the test is successful. In your case, you can use regular expressions to check for appropriate numbers, just replace your very last .wait() line with this:
.wait( getTextInput("age").test.text( /^(\d|1[0-8])$/ ) .failure( newText("Age should be a number between 0 and 18").print() ) .and( getTextInput("weight").test.text( /^\d+$/ ) .failure( newText("Weight should be a numeric value").print() ) ).and( getTextInput("height").test.text( /^\d+$/ ) .failure( newText("Height should be a numeric value").print() ) ) )
Jeremy