Find Children and Bad Selector

I have Find Children and it’s working exactly the way I want. It returns the right number of matches. I can even have a For loop and Highlight each match. Perfect!

One step further, I can do Find Children, have a For loop, Click on each child (which pops up a window) have code to close that new window by clicking Cancel and it will iterate over all the children correctly (opening and closing a window each time)

The issue is that when I change the body of the For loop to actual code, the first iteration will work, but once it returns back to the original window, I’ll get an error about an invalid selector. I thought that maybe (after closing the pop-up window) that I needed to Attach Window for the Click to work, but that does not fix the issue.

Anyone have any suggestions?

welcome to UiPath community
we can set that selector to accept dynamic attribute value
like if there is any attribute in selector is dynamic which can be compared between the first obtained and second obtained selector for the same element, replace that with wildcard *
like if its aaname, then
aaname = ‘*’
or if we know the dynamic value of those attribtue then we can replace the value with variable as per this thread
if its new version of studio

or iff its old version

kindly try this and let know for any queries or clarification
Cheers @Joshua_RPA