问题
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