Forum Discussion
12 Replies
Sort By
- RickAlmeidaModerator
Please forgive me! As it turns out, we already support this. We've had the UI Automation plugin in TestComplete for some time, but I don't think anyone has ever tried to apply it to a WPF application. To enable UIA support in TestComplete:
1. Go to File->Current Project Properties->Open Applications->UI Automation
2. Enable the asterisk (*) item in the list of accepted windows.
3. Go to File->Current Project Properties->Open Applications->General
4. Move the NativeUIAObject to the top of the priority list.
TestComplete will now see WPF objects in this way: Sys.Process("WpfApplication1.vshost").UIAObject("WindowNameUIA").UIAObject("button3AID")
Where WindowNameUI is the AutomationProperties.Name of the main form and button3AID is the AutomationProperties.AutomationId of a button on that form.
More information is available here: http://support.smartbear.com/viewarticle/55786/
Thanks,
Rick
SmartBear Customer Care
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.- KyliecoastOccasional ContributorAnd is this the same in Test Complete 9?
Hi Kylie,
Yep, still the same.- guruprasadgm06New ContributorHi Kylie,
Even i had a problem with the WPF control "Text Block" where iam unable to use attach property.
i tried using the above didnt work for me. could you please help me on this? - googleid_110402New ContributorHi All,
I'm trying to get the AutomationId property as it described above but the GetValue method throws the following error:
"Invalid procedure call or argument"
The source is:
var automationIdProperty = Sys.Process("pr").AppDomain("DefaultDomain").dotNET.System_Windows_Automation.AutomationProperties.AutomationIdProperty
var value = object.GetValue(automationIdProperty);
The 'object' is a valid WPFObject (ComboBox).
Can someone advice on this?
Is there a way to find more details about this error?
Best Regards,
Yury R. - TanyaYatskovskaSmartBear Alumni (Retired)
Hi,
Yury, please answer the following questions:
- What TestComplete version are you using?
- What .NET Framework version is used to build your app?
Also, please check whether you see the GetValue method on the list of your object's method in the Object Browser.
Guruprasad, could you please describe what issue you faced in detail?
- googleid_110402New ContributorHi Tanya,
I use Test Complete 9.31 and .NET 4.0.
And yes, I see the GetValue method in the Object Bbrowser.
Btw, I'm able to get UIAObject by AutomationId. Is there a way to convert UIAObject to the WPFObject somehow?
Best Regards,
Yury R. - YshippinContributorHi,
I apologize for reviving an old thread,
but is there a plan to implement this property?
We are developping automation for a WPF application, and we are required to use this property.
The fact that FindChild is not able to find it will cause us a great deal of headache... - TanyaYatskovskaSmartBear Alumni (Retired)
Hi,
I've added your vote to the corresponding suggestion in our DB.
At the moment, I cannot tell you for sure when or whether this suggestion will be implemented.
Related Content
- 3 months agoD0UG
- 5 years agolingling_chiang
- 5 years agoautomTest
Recent Discussions
- 9 hours agoSvetaG