Try-catch activity, loop breaks when don't find a match

I have a array of strings containing country names, which I need to match in the web application and select the checkbox e.g.


I am using this for-loop activity with try n catch,

and the loop breaks when it does not find a match, but I want the loop not break just skip and continue with next.
I am using following selector with individual item


and this one is with dynamic selector

could anyone guide me please where I am going wrong?
regards,

@rathi.sham

problem is you are not catching any exception hence it will break

click add new catch

image

click system.exception
image

then it should work

1 Like

you can even do other way as well

Using check app state without try catch as well

use click activity on target appears and continue on target does not appear side

or one more method is continue on exception

Regards

1 Like

@rathi.sham

The mistake is that you are adding continue in finally but not in catch…

But you have another option as well…directly in your click activity there is a continue on error property which you can check and when click fails it simply moves to next step no try catch is needed separately

Cheers

1 Like

Thank you guys for you solutions, all of them are working, the only issue I see is time. Each solution I tried takes about 5 mins to process and will effect overall processing time. I just have 12 items in my array, any idea why its taking that much time and how to reduce time.
Regards!

@rathi.sham

Reduce the timeout for click activity to 5 seconds or so

cheers

1 Like

A better way to do it would be to use a Check App State to see if the value you want exists.

1 Like

Hi @rathi.sham

Since you have 12 items in your array why don’t to try changing the input method of Click activity to Simulate in the properties Panel. Hope it might work.

Hope it helps!!

Regards,

1 Like

That works, Thank you so much!

1 Like

@rathi.sham

Happy Automation :blush:

Cheers

1 Like

@rathi.sham

If you find the solution for your query please mark and close the loop.

Happy Automation.

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.