Katalon Automation Recorder - Tips and tricks

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.

  1. “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.

  2. If you want to create your own number variable for example for while loop use “storeEval” command like:

    command | target | value
    storeEval | 5 | myVar

    If you want to create your own string variable use “store” like:

    command | target | value
    store | myTextGoHere | stringVar

  3. 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.

  4. Pages:
    GitHub - katalon-studio/katalon-recorder-samples: Samples for Katalon Recorder can be really useful if you looking for some new command to use.

  5. 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.

  6. 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; | k

    And 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

  7. 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 :slight_smile: .


Great idea. Hope that @devalex88 will agree. :slight_smile: and people will join and give their own tips and tricks.

A lot depends on the users themselves too.

1 Like

Come on guys, don’t tell me you don’t have any tips :smile:

Pumping this up in case anyone has any tip !

Are we talking about anything? Even basic commands?

How do I save and use a global variable?
Command : store
Target : My Value
Value : MyGlobalVariable

Command : echo
Target : ${MyGlobalVariable}

Or something a bit more unusual, like:
How do I store today’s date as a locale aware string?
Command : storeEval
Target : new Date().toLocaleDateString(“en-GB”)
Value : MyDateString

1 Like

Yea, something more unusual, i never needed date in my test cases but it’s pretty cool and simple to do.

And things that it’s not covered in docs and github example but might be useful.

1 Like