RPA:Windows presentation of path

Hello! Why is the locator for an element different in case of the presentation of the path ?

WindowsElement(item=<uiautomation.uiautomation.TreeItemControl object at 0x000002B1933DA700>, locator=‘name:AutoDb type:TreeItemControl
> path:6 > path:1 > path:1’,

ControlType: TreeItemControl ClassName: AutomationId: Rect: (1069,331,1137,349)[68x18] Name: ‘SEMM02.1.1’ Handle: 0x0(0) Path: 1|1|1|1|1|4|6|1|1

The first one was a list of elements with a print_tree starting from SEMM02,1 the other one from the start of a tree so the values are different but why is the presentation different =

It depends on how you chain locators together, starting from a root element as the source and then diving into relative paths when you search for children.

The simplified “ControlType” printing is the raw control displayed during the Print Tree traversal, while the WindowsElement printed object is our keyword-understandable element object which incapsulates the control seen previously, but based on how you get to retrieve that (from root to root for eg.), you might get different representations of the final locator embedded in the internal item object.

Remember that the Path: you saw there is the path relative to the lastly controlled window (or set anchor) or passed in optional locator into Print Tree, where the path: > path: ... representation is relative one to another (6|1|1), which is then again relative to name:AutoDb type:TreeItemControl and that was outputted like so based on the code you’ve written in the bot. (as we chain parent > child locators when we display them)

1 Like

Thank you for your explaination. I just feel it better if it would be one way of presentation of the path because one could use common functions inside the coding to work with the path. In my testcase (keepass) if have used now another way to find a solution without using the presentation of the path.
Now I can disturbe the process and seldom it will fail. Thank you for your support.

@herbert.semmelmayer would be interesting to see your solution for this!

The DisturbNot.zip contains the Keepass Database and the python programm and the log.txt (console)
plus py.log (logging file) an the ListGroup.txt (the result) without disturbing the process.

The Disturb.zip contains the log.txt, py.log and ListGroup.txt where I tried to disturb the process. You can see on the log.txt that some keywords failed.

You are welcome if you need some more information.
DisturbNot.zip (117.6 KB)
Disturb.zip (104.5 KB)

You should remove line 213 and 214 if they cause problems

The problem with the presentation of the path was a mistake of me because I found
[(‘path’, [1, 1, 1, 1, 1, 1, 5], 0)] in the line

2023-04-26 13:38:30,804 RPA.core.windows INFO Locator ‘path:1|1|1|1|1|1|5’ produced matcher: MatchObject(locators=[(‘path’, [1, 1, 1, 1, 1, 1, 5], 0)], _classes=set(), max_level=0)

but did not see that the locator is ‘path:1|1|1|1|1|1|5’ some characters before.