TestProject Forum
Powered by leading experts in the test automation community

Contains text - can we use any expression in contains text field

Hi Team,

I have a test case and in that will pass if a field contains any numeric value. Is it possible in testProject?

Hello, what you can do is first get the text from that field using the ‘Get Text’ action.
Then scroll down a bit in the action configuration and add a validation.

Here, select the output field you would like to validate and choose regex.
And add this as the regex validation: ^\d+$

This will fail the step if there is not at least one number in the text received from the paramter.
If you would like to allow numbers or empty result you can use this regex: ^[0-9]*$

Thanks @david.goichman. I will apply this in script.