Search code examples
pythonpywinauto

Is there a way to get same information with Pywinauto from wrapper than WindowsSpecification object?


So I get this information from the wrapper using get_focus() function in a window:

{'class_name': 'Edit', 'friendly_class_name': 'Edit', 'texts': ['', ''], 'control_id': 232, 'rectangle': <RECT L251, T523, R485, B545>, 'is_visible': True, 'is_enabled': True, 'control_count': 0, 'style': 1342242944, 'exstyle': 516, 'user_data': 0, 'context_help_id': 0, 'fonts': [<LOGFONTW 'Arial' -13>], 'client_rects': [<RECT L0, T0, R230, B18>], 'is_unicode': False, 'menu_items': [], 'automation_id': '', 'selection_indices': (0, 0)}

And I know that it is the same as WindowSpecification (found out by using control_identifiers() and then wrapper_object() function):

Edit - ''    (L251, T523, R485, B545) 
['Edit2', 'TunnusEdit']
child_window(class_name="Edit")

As you can see the wrapper doesn't have the name TunnusEdit. Can I some how get this information from the wrapper?


Solution

  • No, you have to create multi-level WindowSpecification for now. We're planning to add this feature in future releases. But can't promise it will be fast. See issue #570.

    EDIT1: if you're using "win32" backend (default for Application()), it supports only 2 levels of WindowSpecification: the first one is for top level window and the second one is for any descendant. So something like app.MainWindowTitle.TunnusEdit.wrapper_object() would help.