Katalon recorder runs pause command even if it's within a false if statement

I’m currently using pause statements within if statements. For instance:

if | "This"=="That"
click | id=this
pause || 3000
endIf

“this” is not clicked because it’s in a false if statement. However, the pause is still run, forcing it to occur even inside if statements that evaluate to false.

I’m not sure if this is a bug, or if there’s a workaround available.

Thanks!

1 Like

Hi,

Did you find a solution to this? I am running into this now.

@travis.ellis Can we see what you have written so that we can check other possibilities? And what version you are running?

|store|5|VendorId|
|store|3|VendorId2|
|if|${VendorId2} == ${VendorId}||
|click|//div[@id='main_middle']/div[2]/div/div/app-product-mapping/div/div/div/div[8]/div/button||
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[2]/div/select||
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[2]/div/select|label=${State2}|
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[3]/div/select||
|pause||1000|
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[3]/div/select|label=${County}|
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[4]/div/select|label=${Product Type}|
|type|//input[@type='text']|${Turn Around Time}|
|type|xpath=(//input[@type='text'])[2]|${Price}|
|click|//button[2]||
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-product-mapping/div/div/div/div/div/h2||
|endIf||

The 1 second Pause is always happening.

So I have figured out a way around this

|store|5|VendorId|
|store|3|VendorId2|
|gotoif|${VendorId2} != ${VendorId}|Foo|
  |click|//div[@id='main_middle']/div[2]/div/div/app-product-mapping/div/div/div/div[8]/div/button||
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[2]/div/select||
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[2]/div/select|label=${State2}|
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[3]/div/select||
|pause||1000|
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[3]/div/select|label=${County}|
|select|//div[@id='main_middle']/div[2]/div/div/app-add-entry/div/div/div[2]/form/div/div[4]/div/select|label=${Product Type}|
|type|//input[@type='text']|${Turn Around Time}|
|type|xpath=(//input[@type='text'])[2]|${Price}|
|click|//button[2]||
|waitForElementPresent|//div[@id='main_middle']/div[2]/div/div/app-product-mapping/div/div/div/div/div/h2||
  |label|Foo||

The gotoif will skip the entire block if the condition is not matched. This is actually searching in the inverse way for what I was doing, but seems to work quickly.