How to check if there is text inside of a textbox?

Hi
Im trying to make an IF condition, but dont know how to check if text is present in textbox…

it’d look something like this :

storeTextPresent | TextinTextbox | variableA
if | VariableA==true |
click | link
else | whatever

How can i check if there is text in the text box and make a variable out of it like this ?

@antonincaeiro, please try https://docs.katalon.com/katalon-studio/docs/webui-get-text.html

Katalon recorder solution, or lack thereof please.

Hi, Katalon in Reference tab suggest to use storeTExt instead storeTextPresent. It’s should work just how you wrote this. If there is nothing in textbox, variableA should give false in if condotion, Remember to use “andIf” command as well.

Try something like this:

open | https://katalon-test.s3.amazonaws.com/demo-aut/dist/html/form.html | |
# | This will store false in the variable IsTextPresent | |
storeValue | id=first-name | textValue |
if | "${textValue}" == "" | |
store | false | IsTextPresent |
else | | |
store | true | IsTextPresent |
endIf | | |
echo | IsTextPresent = ${IsTextPresent} | |
# | This will store true in the variable IsTextPresent | |
type | id=first-name | Hello World |
storeValue | id=first-name | textValue |
if | "${textValue}" == "" | |
store | false | IsTextPresent |
else | | |
store | true | IsTextPresent |
endIf | | |
echo | IsTextPresent = ${IsTextPresent} | |

This demonstrates the if...else...endIf statement twice. First run with empty text and second run with text

1 Like