I was using Ranorex spy to highlight some elements on our UI and noticed that it no longer worked to highlight tree items. So, I clicked on the tree to find out why and I see this (Image attached). The tree items are invalid, why is this? And how can I get them to be valid again?

Typically, an element becomes invalid when it's no longer available in UI. In case of tree elements, it may happen if the content of tree is scrolled. Simply put, the no longer visible tree items are not in memory anymore. Usually, it happens with lazy loaded lists (tree elements, combo boxes, etc).

Typically, an element becomes invalid when it's no longer available in UI. In case of tree elements, it may happen if the content of tree is scrolled. Simply put, the no longer visible tree items are not in memory anymore. Usually, it happens with lazy loaded lists (tree elements, combo boxes, etc).

This happens when any tree element is clicked. It is still on the screen, why would it not be considered visible or in memory?

"Invalid" means that the UI actually changed since the element has been found by Ranorex and the element is no longer connected to the UI. This typically happens if you track an element with Ranorex Spy, then change something (substantially) in the application, e.g. navigate to another web page or the UI is refreshed.

You did not mention the exact sequence of steps to reproduce this, nor did you post a Ranorex snapshot of the UI. Could you possibly provide both?

Besides, if that happens while using Spy, you can try to refresh the element tree by clicking the toolbar item or pressing F5. Ranorex Spy does not refresh automatically, unless you track another element.