打印Windows商店应用控件标识符遇_ctypes.COMError,求解决方案
求助:打印Windows商店应用控件标识符时出现COM错误
应用环境
Windows商店应用(基于React Native + WebView开发)
代码实现
app = Application(backend='uia').start( r"powershell.exe /c start AppName", create_new_console=True, wait_for_idle=False) app = Application(backend='uia').connect(title_re=".*App Title*.", found_index=0, timeout=10).AppName print(app.print_control_identifiers())
输出内容及错误信息
部分控件标识符输出
| ComboBox - 'Test' (L2771, T247, R2871, B268) | | | | | | | | | | ['ComboBox', 'test', 'testComboBox', 'ComboBox0', 'ComboBox1'] | | | | | | | | | | child_window(title="Test", control_type="ComboBox") | | | | | | | | | | | | | | | | | | | | ComboBox - 'testing' (L2875, T247, R2975, B268) | | | | | | | | | | ['testing', 'ComboBox2', 'TestingComboBox'] | | | | | | | | | | child_window(title="tesing", control_type="ComboBox") | | | | | | | | | | | | | | | | | | | | Static - '(' (L2978, T251, R2981, B264) | | | | | | | | | | ['(Static', '(', 'Static56'] | | | | | | | | | | child_window(title="(", control_type="Text")
错误栈
Traceback (most recent call last): File "foo\boo\test.py", line 96, in <module> print(test.getcontrolidentifiers()) File "foo\boo\test.py", line 57, in getcontrolidentifiers return self.app.print_control_identifiers() File "foo\boo\\application.py", line 689, in print_control_identifiers print_identifiers([this_ctrl, ]) File "foo\boo\\application.py", line 685, in print_identifiers print_identifiers(ctrl.children(), current_depth + 1, log_func) File "foo\boo\\application.py", line 685, in print_identifiers print_identifiers(ctrl.children(), current_depth + 1, log_func) File "foo\boo\\application.py", line 685, in print_identifiers print_identifiers(ctrl.children(), current_depth + 1, log_func) [Previous line repeated 7 more times] File "foo\boo\\application.py", line 641, in print_identifiers ctrl_id = all_ctrls.index(ctrl) File "foo\boo\\base_wrapper.py", line 662, in __eq__ return self.element_info == other.element_info File "foo\boo\\uia_element_info.py", line 360, in __eq__ return bool(IUIA().iuia.CompareElements(self.element, other.element)) _ctypes.COMError: (-2147220991, '无法调用任何订阅者的事件', (None, None, None, 0, None))
运行上述代码时,程序在打印控件标识符过程中抛出了_ctypes.COMError,错误代码为-2147220991,提示信息为“无法调用任何订阅者的事件”,目前不清楚问题根源和解决方法,恳请各位帮忙。
内容的提问来源于stack exchange,提问作者Learner
相关产品推荐
相关产品推荐

