应用程序在通过ui自动化进行自动化时崩溃

2024-05-16 18:22:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用uiautomation library用python自动化一个应用程序。En python 3.6.8

当我使用该方法时,我可以毫无问题地访问应用程序的任何元素

control = auto.ControlFromCursor ()
print (control.AutomationId, control.Name)

但是,当我尝试根据元素的属性创建元素时,应用程序会中断

control = auto.Control(AutomationId=id_, Name=name, ClassName=cls_name)

即使我这样做,它也失败了

control = auto.ControlFromCursor ()
print (control.AutomationId, control.Name)
id_ = control.AutomationId
name = control.Name
cls_name = control.ClassName 
control = auto.Control(AutomationId=id_, Name=name, ClassName=cls_name)

这是我从微软找到的,但我不知道在哪里可以找到这些修补程序,也不知道该怎么做。有什么想法吗?:/

https://support.microsoft.com/en-us/topic/applications-crash-when-automated-by-a-ui-automation-client-app-in-windows-b746d17a-fda1-a1a2-9290-431fa155e859

这就是错误所在

enter image description here


Tags: nameid应用程序元素autolibrarycontrolcls