How to add If else command in recorder

I’m not able to add if else command. What is the correct way to add that in the script.

Hello Deepika,
welcome in the Katalon community.
You can use the if command very easily, here an example:

Best regards
Stefan

KatalonAutomationRecorder_IfExample.JPG

Hello
I want to test
**if i not equal to 1 **
i don’t find how to test
can you help me ?

1 Like

if ${i} != 1

1 Like

ok thanks :slight_smile:

hi i need find string to verify (If statement)

“No more candidates awaiting Authorization” this is shown in body text then continue the expression otherwise wait

Help me

You want to test this string ?
You can store this in a variable eg . lv_Text
If lv_Text==“No more candidates awaiting Authorization”

In Katalon recorder it doesn’t recognize if statement even though its in the list. I’m trying verify if text is on the webpage but not having any success. I’m using an xpath for the target as we cannot create unique IDs in Salesforce. Any ideas?

why some commands are executed even the condition is not true?..

in my example close is inside if and even with condition is false is being executed?

1 Like

Hi
pamcsmash, do you run entire test case or double clicking commands?? You need to run full testcase or at least use “Play From Here”. It’s the last option in context menu when you right click on some command. Double clicking the command can work only for simple command like click or something.

brian123abcd, Katalon just work that way. It’s mark it green because there was no error in this command and it goes throught it properly not neceserliy execute it. For what I know the only command that really execute inside if even when the condition is false is pause command.

Hi, I need some help
I want to test whether there is Chinese in language.csv and load different files
But it loaded two files and echo 1 and 2
please help me thanks

@zoe.lee Please insert endLoadVars before the second loadVars. You also need an endif to close the if command. Currently you have to add these closing statements manually, but we’ll work on making them easier to use.

1 Like

Thanks!
It does work !!!

1 Like

good. Could you help me with respect to creating a command to use in this example: I want to enter a website with a login but I only have to enter in a certain time. I would like to make the script so that I keep trying to enter until they let me in. help please

Hello good, I need help, it happens that I need to know how to declare a variable (program button in the example) and say that if that button appears enter the if and exit the loop, could you help me here is an example made in nodejs
while (true) {
await page.click(‘button[type=“submit”]’);
const [programar] = await page.$x(’//button[contains(.,“Programar”)]’);
if (programar) {
break;
}
}