Python-UIAutomation-for-Windows
Python-UIAutomation-for-Windows copied to clipboard
找控件, 经常会间歇性的遇到这个问题 _ctypes.COMError
if not profile_hyperlink.Exists(15):
File "C:\Users\C950R_V18_Athena\AppData\Local\Programs\Python\Python39\lib\site-packages\uiautomation\uiautomation.py", line 6387, in Exists control = FindControl(self.searchFromControl, self._CompareFunction, self.searchDepth, False, self.foundIndex) File "C:\Users\C950R_V18_Athena\AppData\Local\Programs\Python\Python39\lib\site-packages\uiautomation\uiautomation.py", line 8288, in FindControl for child, depth in WalkControl(control, findFromSelf, maxDepth): File "C:\Users\C950R_V18_Athena\AppData\Local\Programs\Python\Python39\lib\site-packages\uiautomation\uiautomation.py", line 8169, in WalkControl child = lastControl.GetFirstChildControl() File "C:\Users\C950R_V18_Athena\AppData\Local\Programs\Python\Python39\lib\site-packages\uiautomation\uiautomation.py", line 6256, in GetFirstChildControl ele = _AutomationClient.instance().ViewWalker.GetFirstChildElement(self.Element) _ctypes.COMError: (-2147220991, 'An event was unable to invoke any of the subscribers', (None, None, None, 0, None))
这个问题还是挺常出现的
第一遍打卡窗口执行GetValuePattern().SetValue(info) ,反复多次操作都没有问题,但关闭窗口后再打开,再次执行GetValuePattern().SetValue(info) ,必现报 File "D:\soft_install\python3.8.8\lib\site-packages\uiautomation\uiautomation.py", line 5541, in SetValue ret = self.pattern.SetValue(value) == S_OK _ctypes.COMError: (-2147220992, None, (None, None, None, 0, None))