|
6#
楼主 |
发表于 2007-12-5 11:44:39
|
只看该作者
结帖, 使用微软Automation Elements 技术
使用微软最新的Automation UI技术, QTP也建议使用.就是例子不多Automation Elements
'Using the “Selection Pattern” of UIAutomation to get the current selections
'object1 is an “Array” of “AutomationElement”, refer to MSDN for class ‘ “SelectionPattern”
Set object1 = WpfWindow("YourWindow").WpfTreeView("MyTreeView").AutomationPattern_("Selection").Current.GetSelection()
'Using the method “GetValue” of “Array” , refer to MSDN help for “Array” class
'object2 is an object of “AutomationElement”
Set object2 = object1.GetValue(0)
'Using the “Current” property of “AutomationElement” to get object of ‘“AutomationElementInformation” and his property “BoundingRectangle”
' object3 is an object of “Rect” , refter to MSDN
Set object3 = object2.Current.BoundingRectangle
'class “Rect” has the property x, and y
x = object3.x
y = object3.y
'Doubleclick
WpfWindow("YourWindow").WpfTreeView("MyTreeView").DblClick x,y |
|