For Each UI Element Loop Not Working

Hi there,

Still relatively new to StudioX so this may be a silly question, but I have an automation that’s generating a report. I have it setup to generate but now I need the program to loop through clicking on each UI element in the report that says “Invalid” to scrape the data from each sub report. However, when I run the program the loop does not seem to be picking up any of the elements at all. Does anyone know what I’m doing wrong here?

I believe it’s because of the condition in your If. You are comparing CurrentElement to “Invalid”, which will never be true since CurrentElement is of type UiElement and “Invalid” is a string. Perhaps you want to use the GetText activity to get the text of the element, or use the CurrentElement_label?

Hi,

Can you try to use CurrentElement_Label as the following?

CurrentElement_Label.Equals("Invalid")

Please input the above using Advanced Editor.

image

Regards,

I tried that out but it didn’t work. It doesn’t seem to be reading any elements at all as it tries to close the page before it’s even run the loop.