from pywinauto import application
app = application.Application().connect(process=7996)
app.print_control_identifiers()
为什么此代码不起作用?它会产生错误。
AttributeError: Neither GUI element (wrapper) nor wrapper method 'print_control_identifiers' were found (typo?)
我能想到的唯一原因是因为它是64位应用程序,而我有32位Python。
答案 0 :(得分:0)
connect()
在您的代码中运行良好。下一行:print_control_identifiers()
不是app
对象的方法。您需要为此创建顶级窗口规范:
app.TopWindowTitle.print_control_identifiers()
列出顶部窗口标题:
print([w.window_text() for w in app.windows()])