How to verify input box text

Hello katalon users,

Please is there a way to verify a text which was typed into the input box/edit field/text box {or how you want to call it}?

I mean something like this: you have a input box with written text “demo” and you want to verify if was typed into the box a word “demo”.

“WebUI.verifyElementText” and “WebUI.verifyTextPresent” are not working on input box.

Thank you for any response


Please share the HTML code of your page (be sure to include the fragment of the input box), and a screenshot of the page rendered in browser.

Hello, its not a problem related to my page, its general I believe, but sure, why not. Im not able to paste a code here even within the code tags, so I hope it will enough like this. Thank you very much


try to get field attribute value to variable liek next:

def txt = WebUI.getAttribute(findTestObject(“Object Repository/withoutSpaces/Page_CURAHealthcareService/input_Username_username”), “value”)

if (txt.length() > 0){

println("DEBUG txt field value: "+txt)



throw new com.kms.katalon.core.exception.StepErrorException(‘Value required’)


1 Like

Maybe a workaround would be to get the text with the “Get Text” Keyword and save it in a variable… Then do a equals check on it.

Or if the get text keyword does not work you can try to get the text with the “Get Attribute” Keyword by getting the attribute “value”

Hello, Im not able to do this, can I ask you for a code example? As the design of this forum has changed and I get only broken links when I try to google stuff{how to} on my own. Thank you

I was trying your code{thank you for that}, however it is not what I have expected right now. Your code is basically just checking if the edit box is empty, when is, than the test got failed, else it goes on. Which is not bad at all, as I was looking for something like this as well, but not at this moment :grinning: Or em I not getting the true purpose here?

In script view it should look like:

variableHoldingValue = WebUI.getAttribute(findTestObject(‘xyz/yourTestObject’), ‘value’)

WebUI.verifyEqual(variableHoldingValue, textToCheckAgainst)


Yes I have done that, and it is working, thank you so much!

WebUI.setText(findTestObject(‘UAT/Settings/Currency and rates/input__name’), ‘demo’)

a = WebUI.getAttribute(findTestObject(‘UAT/Settings/Currency and rates/input__name’), ‘value’)

WebUI.verifyEqual(a, ‘demo’)

my example was not solution to your probs, it was only example where you will start

Yeah it was, but not for this problem, it was a solution to a problem only in my head for now, so thank you for that :grinning:

Unfortunately, you are at the mercy of the DOM in these cases. input elements do not always contain an attribute that holds the current value of the field, nor are they required to. In my experience, the actual value can be found in a number of places, depending on the DOM:

1.) The value attribute.
2.) A child text node.
3.) Some other element that’s a near relative, like a span sibling, for example.

Every DOM is different, so you will need to take a different approach depending on your case. A couple of tips:

1.) Sometimes the value sitting in the field won’t be baked into the DOM, and thus rendered, until some other action on the page is taken, like a save, or a page refresh, etc. This is often a consequence of how the Javascript is listening for events.
2.) Try and save the HTML of the page and open in a text editor, then conduct a find for the text “demo”, to see if the value is indeed being held somewhere else in the DOM.

Hope this helps!



I have multiple text boxes to verify the entered text. How can i do that?

Hi Team,

How to verify the text box value is pre populated?

Thanks in Advance,

It is working for me. Thanks