For-Loop Element Exists

Hello! I am running a for loop, and the loop works on the first iteration of the command that is highlighted in the image (the ok) button using the find element exists activity as boolean for an if statement; however, upon subsequent iterations, the loop loses functionaility. Any ideas on how I can make this loop more effective.

use a try catch block buddy
–if the element appears and if we are not able to process further it will go to catch block where we can have in common a find element activity and the boolean output can be used to click or not,
–still after this we need to place the process that we had in try block to continue with the process

Cheers @csewall3

Hi @csewall3,
Try to keep some delay action in the loop, sometimes it takes some time while performing the other end but the bot executes it quickly. So, use the delay activity and delay for like 5 seconds and check.

Thank you for your reply! I am relatively new to uipath so I dont really have a super good grasp on how to implement this within the platform. Would I include the find element activity within the try block, and what would I put within the catch block (the common find element activity)

1 Like

Hi bro,
Keep the code which you have done in the try block and if any error occurs it will go the catch block and you just keep the code which you want to implement if any error occurs.

no worries
–use a try catch block
–keep all the activities inside the try block except find element activity
–if any exception occurs because of that popup window, it will go to catch block where at the very first use a find element activity and check whether that element occurs,
–this find element activity gives us the boolean variable named bool_elementexists and use a if condition next to this activity and mention the condition like this
bool_elementexists = True
if this condition passes it will goto THEN part where use a click activity to click on that ok…its done…
–but we need to make sure that the process should continue after click ok on that popup,so before developing this process we will know where this popup occurs along the process and based on that we would have used certain set of activities to be performed before this popup and after this popup…
–so after this click activity next to the if condition re mention all the activities in catch block to perform the activities that are to be performed next to this popup…so that the bot will continue its process

Thats all buddy
Kindly revert for any queries or clarification
Cheers @csewall3

1 Like

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