I use the path as locator in print tree and get an error if some higher level then the one in the locator exists in the window. My testcase is KeePass which is part of the ProblemPath1.
ProblemPath1 is running without error because I collapse the groups below the level of path in the selector.
ProblemPath2 shows the error if I make all groups visible.:
File “D:\PYTHON\tools\KeePassV90.py”, line 119, in
all_elems = lib.print_tree (“path:1|1|1|1|1|1|5”, max_depth=16, return_structure=True)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\Windows\keywords\elements.py”, line 117, in print_tree
return super().print_tree(
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\elements.py”, line 63, in print_tree
target_elem = self.ctx.get_element(locator)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\context.py”, line 87, in wrapper
return func(self, *args, **kwargs)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\Windows\keywords\locators.py”, line 77, in get_element
return super().get_element(
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\context.py”, line 87, in wrapper
return func(self, *args, **kwargs)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\locators.py”, line 418, in get_element
element = self._get_element_by_locator_string(
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\locators.py”, line 391, in _get_element_by_locator_string
control = self._get_control_with_locator_part(
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\locators.py”, line 356, in _get_control_with_locator_part
return self._get_control_from_path(search_params, root_control)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\RPA\core\windows\locators.py”, line 311, in _get_control_from_path
raise ElementNotFound(
RPA.core.windows.context.ElementNotFound: Unable to retrieve child on position 5 under a parent with partial path ‘1|1|1|1|1|1’
PS D:\PYTHON>