How to know if a list contains a UiElement

I need to make a list of UiElements, and constantly check for new UiElements, only adding the ones that aren’t already on the list.

On the first pass, 5 google results should be added to the list; which should be highlighted in blue. But on the second pass, it should get the exact same elements, and “ignore” them all, since they are already on the list.

It should be as simple as using the following expression, but that doesn’t seem to work:
elmntList.Contains(elmnt)=false

I’ll include the demo process so you can test it for yourselves.
Google Test.xaml (26.6 KB)

Use Find Children providing the filter to get all Childs inside the browser. Change Scope Property according your needs. Provide desired Target Selector

The rest of Logic is List Manipulation.

2 Likes

Thanks. Your solution would get me the elements in this case, by using
"<webctrl tag='H3' />"
as a filter, but the Google Test.xaml file was just an example. What I really need is to be able to tell if a UiElemeny is already in a list.

In this Case, Iterate over the List, inside use Get Attribute activity to get a specific Attribute to compare against something to know if it exist.

1 Like

That’s probably what I’ll do, but maybe with multiple attributes. But it seems to me that it should be possible to know if an element is equal to another element in a list.

Maybe, however it would be a bit hard in terms of compare object vs object, attributes vs attributes and Values vs Values. Rather you can focus only in Key Attribs or Key Values and avoid Extra Checks and save memory

1 Like