Pick up where it left off using for each Ui element

Hello,

I am stuck and newer at UiPath. I am trying to use the for each ui element activity. It works great…. It will run till the webpage times out and for security reasons makes you log in again. When that happens I have invoke my login workflow and then continue on but I don’t want it to start at 1. I want it to start where it left off. There are 311 elements in my collection and it will get to 35-40 before it times out. How do I get it to start at that last one and continue on until it completes or times out again? My current list of activities is as follows

For each ui element with a collection of 311 items variable is currentelement
Process begins:
Fills in start date
Fills in end date
Fills in radio button
Clicks (input element: var_currentelement)
Submits and waits for download
Closes download window
Continues to the next element

How do I get it to continue through process after timeout. As I mentioned correctly operates through 35-40 of them till my site logs out.

I appreciate your help

Create a new variable out of for each loop

Should looks like

Assign index = 0

For Each …
// tasks
Assign index = index + 1
End For Each

Now if for each ends u have and index for use on UiElement(index)

For Each UI Element doesn’t work like Find Children where you get an array of UI Elements.

@Rogue243 Bryann is close, you will need to store the number of the item you were on before it timed out. Even though it isn’t defined anywhere, you can use CurrentIndex within a For Each UI Element to get the current element’s index. So store that in a variable (SkipToIndex) when it times out. Then all you have to do is use an If around all the steps inside the For Each UI Element to check the value of CurrentIndex against your SkipToIndex variable. If CurrentIndex >= SkipToIndex Then do all your processing steps. Make sure you set the default of SkipToIndex to 1 so on the first time around it has a value and will start from the first item.