因此,我在窗口中使用 get_focus()
函数从包装器获取此信息:
{'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)}
而且我知道它与 WindowSpecification 相同(通过使用 control_identifiers()
和 wrapper_object()
函数发现):
Edit - '' (L251, T523, R485, B545)
['Edit2', 'TunnusEdit']
child_window(class_name="Edit")
如您所见,包装器没有名称 TunnusEdit
。我可以知道如何从包装器中获取这些信息吗?
最佳答案
不,您现在必须创建多级 WindowSpecification。我们计划在未来的版本中添加此功能。但不能保证会很快。请参阅issue #570 .
EDIT1:如果您使用“win32”后端(Application()
的默认值),它仅支持 2 级 WindowSpecification:第一个用于顶级窗口,第二个用于对于任何一个后代。因此像 app.MainWindowTitle.TunnusEdit.wrapper_object()
这样的东西会有所帮助。
关于python - 有没有办法从包装器中使用 Pywinauto 获取与 WindowsSpecification 对象相同的信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54803886/