TestProject Forum
Powered by leading experts in the test automation community

How to validate textbox is not null

I want to validate whether the textbox is input with value without knowing what is the exact value. It seems not able to use gettext/containt text? to do this.

Hello, and thanks for reaching out.

You can actually use the ‘Get Text’ action to check if a text box is empty.
Use get text and add a validation:

Create a regex validation on the text output field:


The regex you can use is: ^(?!\s*$).+​
This will reject anything that does not contain any characters.

If the text box is empty it will reject it:

And if it contains anything (excluding spaces) it will accept:

If you want the opposite, the result to be true when empty, simply invert the step result:


Thank you for the fast workaround. :wink: