Forum Discussion
Dmitry_Nikolaev
14 years agoStaff
Hello Harshad,
You can use any available object properties in Name Mapping for object recognition. So, if you see the AutomationID property in the property list, you can map objects by using this property.
But if you are testing a WPF application, the situation is different - the AutomationID property is not available for WPF objects, because the property is implemented as an attached property. TestComplete 7 doesn't show attached properties in the available property list, so you can't use it for Name Mapping. You can get the property value from script though:
Set AutomationIdProperty = p.AppDomain"Automation_ID_Sample.exe").dotNET.System_Windows_Automation.AutomationProperties.AutomationIdProperty
AutomationID = MyObject.GetValue(AutomationIdProperty)
Log.Message(AutomationID)
So, if you need to use an attached property's value to get a certain object, you will need to implement a custom search function in TestComplete script. The function should iterate through objects in the application's object tree and check the attached property's value by calling the GetValue method.
Related Content
- 4 months agoD0UG
- 5 years agolingling_chiang
- 5 years agoautomTest
Recent Discussions
- 11 hours agosimonaferrara
- 20 hours agoSubhraDas