How to know the ControlType of a UI Element from CurrentControlType property

回眸只為那壹抹淺笑 提交于 2021-02-08 09:00:24

问题


Basically I am using UIAutomationClient.Interop.dll for some UI work I am currently doing and I am facing the following issue:

  • I have a UI Element I would like to know its Control Type.
  • UIAutomationClient.Interop.dll exposes the following property: IUIAutomationElement::CurrentControlType property
  • Above property returns an Int that represents the Control Type ID but not a ControlType object.

Question:

  • How could I know what is the ControlType of an UI Element by just knowing its ID? I was not able to find out any other useful information.

NOTE:

I am using the UIAutomationTypes.dll to definte the ControlType object

Any idea?


回答1:


I use GetCurrentPropertyValue(AutomationElement.ControlTypeProperty) in IronPython. Probably this is what you want. It should return ControlType object. Though I use its string representation .ProgrammaticName.lstrip('ControlType.').strip("'").



来源:https://stackoverflow.com/questions/24747375/how-to-know-the-controltype-of-a-ui-element-from-currentcontroltype-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!