Hi Stack Overflow社区,
我需要为客户自动化专有应用程序。我已经能够成功运行一些示例代码here(即pywinauto在记事本上工作)。对于专有应用程序,似乎任何elements_from_uia_array(ptrs_array, cache_enable)
的最终调用都会失败,并且此应用程序具有相同的NULL COM指针访问错误。我应该如何解决这个问题?
上下文:
这是我尝试从WindowsSpecification创建包装器对象时获得的堆栈跟踪。任何顶级窗口上的print_control_identifiers()
也会给我同样的错误。
>>> test = actual_window.child_window(auto_id="_buttonFindStudent",control_type="Button")
>>> test
<pywinauto.application.WindowSpecification object at 0x000002277006DC50>
>>> profit = test.wrapper_object()
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
profit = test.wrapper_object()
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 254, in wrapper_object
ctrls = self.__resolve_control(self.criteria)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 245, in __resolve_control
criteria)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\timings.py", line 425, in wait_until_passes
func_val = func(*args)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\application.py", line 209, in __get_ctrl
ctrl = self.backend.generic_wrapper_class(findwindows.find_element(**ctrl_criteria))
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\findwindows.py", line 84, in find_element
elements = find_elements(**kwargs)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\findwindows.py", line 214, in find_elements
depth=depth)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 283, in descendants
elements = self._get_elements(IUIA().tree_scope["descendants"], cond, cache_enable)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 262, in _get_elements
return elements_from_uia_array(ptrs_array, cache_enable)
File "C:\Users\SK2\AppData\Local\Programs\Python\Python36\lib\site-packages\pywinauto\uia_element_info.py", line 48, in elements_from_uia_array
for n in range(ptrs.Length):
ValueError: NULL COM pointer access