I'm beginning to explore the possibility of doing UI automation using the UI Automation library that came with .NET 3 (will be using c#). There aren't a ton of tutorials out there on this, but the ones I have seen usually involve getting the AutomationID property from a control on the application to be tested. The problem is, using UISpy and WPF Inspector, it doesn't appear that the application I'm testing has the AutomationID property populated (it's a WPF application). Also, sometimes the Name field is populated, but sometimes it's not.

Given this, is UI Automation going to be possible from the standpoint of a custom solution, or will I have to use some kind of record/playback tool (and if so, how would those tools work given the absence of these attributes)?

up vote 2 down vote accepted

The answer depends on how comfortable you are programming. You can definitely find what you need using UI Automation without names and IDs. However, I found that the managed classes can find much less than the unmanaged. This post sums this up nicely:


(look at Guy Barker's response)

His point (i) is what I am doing. Point (ii) may be easier. Ultimately it is access to the Legacy Accessibility API stuff that made the difference for me.

I would suggest trying out Coded UI and Test Complete. If they can successfully find your objects and manipulate them when you playback, then you may want to go that way, but keep in mind that you will have to refactor the recordings.

If they don't work and you are comfortable programming, then definitely try out the unmanaged UI Automation stuff first.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.