I have a very simple For Each Ui Element activity that has a few clicks throughout a single iteration. At the end of each iteration however, one item in the collection (obviously the first item) will get automatically achieved, thus removing it from my collection. With that, my bot never makes it to the second iteration as the collection “is no longer the same”.
How can I get this collection to be dynamic each iteration until there are no more items in the collection upon last iteration?
@chris.bartkewicz
Have a copy of the collection stored in a different variable that you are using in the for each ui element activity, remove items from this collection using invoke method once done.
You mean on ui would the first row be removed and that is causing the issue?
If so ideally you need the first item always irrespective of the number of items and loop iteration
If that is the case then identify a unique selector for the first element which does not depend on the value but the position..then in loop you can use the same selector to perform all steps and use check app state to check if there is first item then continue else end the loop
So basically you would be using a static selector which works for any first item
I thought about this as a solution, however, every first item in the ui collection in the first row disappears as it is a ticket item that will be resolved in each iteration.
What would an argument look like using the inx selector? like make the index value a wildcard so that it loops regardless of the current value of items in the collection?
If the page is changing each time and the item you processed disappears, you shouldn’t use For Each UI Element. You should use a Do While and inside it handle the first item in the list. Use a Check App State to make sure there is an item visible, and use its output in the Do While condition so it’ll stop looping when there are no more items.