既没有找到 GUI 元素(包装器)也没有找到包装器方法“print_control_identifiers”(拼写错误?)

问题描述 投票:0回答:1

Neither GUI element (wrapper) nor wrapper method 'print_control_identifiers' were found (typo?)
以下代码返回此错误:

        # wait for the window to come up
        self.main_window_dialog = self.app.window(best_match='ArtManager').wait('ready')
        self.main_window_specification = self.app.window(best_match='ArtManager')

        for child in self.main_window_specification.Children():
            logger.debug(f"Child: {child}")
            logger.debug(f"Child type: {type(child)}")
        logger.debug(f"app type: {type(self.app)}")
        #logger.debug(f"Controls:\n {self.app.dump_tree()}")
        logger.debug(f"Print control identifiers:\n {self.app.print_control_identifiers()}")

当提到

self.app
时,我期望属于
Application
班级,它是:

[1;34m2023-09-21 11:07:27,425 - (art_manager.py:62) - tqma - DEBUG - app type: <class 'pywinauto.application.Application'>[0m

根据文档,该类确实包含

print_control_identifiers
https://pywinauto.readthedocs.io/en/atspi/code/pywinauto.base_application.html#pywinauto.base_application.WindowSpecification.print_control_identifiers

但是我收到错误。我究竟做错了什么? 当尝试为

print_control_identifiers()
self.main_window_dialog
运行
self.main_window_specification
时,我也收到错误(表示没有此类属性/成员)

python pywinauto
1个回答
0
投票

因为

app
对象没有方法
dump_tree()
或其别名
print_control_identifiers()
。它只是 WindowSpecification 对象的一个方法。在未来的版本中,它也将被添加到包装对象中。不过没有
Application
对象的计划。

© www.soinside.com 2019 - 2024. All rights reserved.