Issue with treeview

I’m trying to navigate through a treeview with my robot. Majority of the time i’m running it the robot does not find the right folder in the treeview.

The selector i’m using looks like this:

Alt 1:

<wnd cls='SysTreeView32' idx='2' />
<ctrl name='Agresso Økonomi' role='outline item' />

Alt 2:

<wnd cls='XTPDockingPaneTabbedContainer' title='Meny' />
<wnd cls='SysTreeView32' idx='1' />
<ctrl name='Agresso Økonomi' role='outline item' />


Is there also a way that I could close the treeview when the task is done so the robot starts from the beginning next time it is running?

Did you try click text activity?
If not you can try Find Children Activity and use get attribute where you can extract the aaname of each children in a loop into an array or list finally pass the variable to click event.