TestProject Forum

Validating a number is present in an element

What’s the easiest way to validate a number is present in an element? “Contains Text” will validate it whether it has a number or a string.

Hey @Chris.Rye
Can you please elaborate on your intention?
Do you want to validate there is any number or specific number?
What kind of element is this?

I want to confirm if there’s an integer within this element, it’s just a div–>label–>input html element.

you can achieve it with one step, select the label with element locator, go to actions and then search for “Get Numbers Only”, then add a validation on the output of greater than 0

see the screenshot bellow

let me know if it helps :wink:

2 Likes

Is that from a particular addon? I’m not seeing “Get Numbers Only” come up when I search actions:

I’m on the latest version of TestProject as well.

it’s part of the web extensions addon - Test Automation Addons Library | TestProject

go to your addon page and press update, then try to look for it again. You’re probably using old version of the addon

1 Like

There we go, thank you!