Capture objekt tree structure of elements that disappear
How can I capture properties and objekt tree structure of elements that disappear when clicking in object spy or testcomplete?
The tested app uses custom context menus. These can be captured with object spy (Ctrl+Shift+A). But, when I want to view the object tree structure, it is not available, because the context menus disappears as far as you click into the object spy or other window (""Unable to hightlight this object in the object tree, because it does not exist."). The Context menus are only available until you click outside of them.
The context menus with submenus look like parents and children on the screen, but are not in the object structure. My goal was to access the objects via FindChild and FindAllChildren (The values of the properties should be passed dynamically to a function via parameters. Therefore, name mapping is not an option here.). To make this work faster, I wanted to study the object structure. This way I could better understand the structure and relationships of the objects. But that didn't work.
Other tools can take a snapshot of the object structure or at least show the object structure further (for example Inspect.exe or Appium). So you can view the structure (and properties) of the elements, even if the elements and structure are no longer exist on screen.
With TestComplete, however, this information are only available as long as the element is present on the screen. As a quick solution I wrote my own function (Recursive loop, FindAllChildren, etc.) that automatically captures all elements on the screen and writes the structure in an XML-like file.
So I got what I need. But it's very slow and inconvenient. I would assume that Testcomplete could do something basic like that natively and I just didn't find it. How can I do that?
PS: I work with script test cases and Python.
That's the thing... this isn't an "object" like others. Menus like this are not something you're going to capture with Object Spy or such... They are properties of some other form... specifically, as the documentation says, MainMenu or PopupMenu or something like that. So, you're not going to be able to "map" it or see the parent... that's not how TestComplete sees these objects.
https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/mainmenu-property-window-object.htmlSo, unfortunately, I'm not sure you're going to be able to do precisely what you want with Object Spy or something like that. You should be able to examine/iterate through the "Items" property of the menu object to find out the information you want to know...
https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/menu/items-property-menu-control.html