Katalon Automation Recorder - Tips and tricks
Not everything is covered in documentation and command reference so i create this topic to share with you some things i found useful. Feel free to add yours tips and tricks here as well.
-
“alert();” in addScript don’t work, you need to use “originalAlert();”
Link where I found this: runScript as a replacement for storeEval
If you use runScript you have to click “ok” on alert 2 times. Be aware that Katalon will wait until you click “ok” on alert. -
If you want to create your own number variable for example for while loop use “storeEval” command like:
command | target | value
storeEval | 5 | myVarIf you want to create your own string variable use “store” like:
command | target | value
store | myTextGoHere | stringVar -
If you don’t want to execute some part of your test case use “goToLabel” and “label” commands like this:
click | id=idOfElement | ← this will execute
goToLabel | myLabel ← jump to your label
type | id=someId | text ← this will not execute
label | myLabel |Be aware that sometimes it’s look like Katalon execute “type” command and it’s turns to green but it won’t type anything to “someId” element and sometimes it’s skip commands between “goToLabel” and “label” commands. But it’s work fine it’s just look diffrent sometimes.
-
Pages:
https://docs.katalon.com/katalon-recorder/docs/selenese-selenium-ide-commands-reference.html
and
GitHub - katalon-studio/katalon-recorder-samples: Samples for Katalon Recorder can be really useful if you looking for some new command to use. -
To delete multiple commands at once press and hold CTRL, select all commands to delete by clicking at them - now their selected and press CTRL + X. It’s useful even with one command because delete button don’t work in Katalon.
-
If you want to return multiple values from JS code in runScript/addScript you can return them in next comand runScript. Normally you can’t return two or more values from JS code so this is pretty cool and yet simple workaround. Sample code:
command | target | value
runscript | var i = 1; var j = 2; var k = 3; |
runScript | return i; | i
runScript | return j; | j
runScript | return k; | kAnd from now on you have this all values in Variables tab in Katalon. You may think that i can declare all of this vars in separate runscript command but this method can help if your vars interact with each others within JS and you want to reurtn more then one of them. Be aware that can be problem sometimes with this method. More info and possible solution here: RunScript returning multiple values not always work
-
To add a comment use:
command | target | value
# | your comment here |Would be cool if comments will be colored green.
That’s all from me. Now your turn .