How to get text just inputted into textbox

Hello,

I have an issue want to ask in here. I have a textbox and I want to input a string into, after that, I want to get the string in the text box and compare with string I just using.

For e.g:

text = '123456789abcde'
WebUI.setText(findTestObject('my-testob'), test)
WebUI.getText(findTestObject('my-testob')

it still get text is β€˜β€™ because it not submit to anywhere

How I can solve my issue?
Thank you

text = '123456789abcde'
WebUI.setText(findTestObject('my-testob'), test)
String value = WebUI.getAttribute(findTestObject('my-testob'), "value")
WebUI.comment("value=${value}")      //  will show "123456789abcde"
3 Likes

wow. I using document.querySelector("[name=name]").value but your solution very simple. Thank you so much

1 Like

Thank you for this very simple code but a big help.

Hi there, :wave:

Thank you very much for your topic! It may take a little while before Katalon team member or others forum members respond to you.

In the meantime, you can double-check your post to see if you can add any extra information i.e. error logs, HTML codes, screenshots, etc. Check out this posting guide to help us help you better!

Thanks! :sunglasses:
Katalon Community team

If you don’t need to actually β€œget” the text but just want to verify the text was set in the textbox, then you can use:

WebUI.verifyElementAttributeValue(findTestObject('my-testob'), "value", "your text here", 10)