I have seen several posts on the forum asking how to ensure UIA is used instead of MSAA for all controls. My colleague Rajeev Kumar had once written some sample code that achieves this.
All you have to do is unzip the attached file, build it and put the UIAProxy.dll in %ProgramFiles%\Common Files\microsoft shared\VSTT\10.0\UITestExtensionPackages\ (or %ProgramFiles(x86)%\Common Files\microsoft shared\VSTT\10.0\UITestExtensionPackages\ if it is a 64 bit machine).
Note1: If it is still not working for you. You might have to do some code changes in the UIAProxyTechnologyManager.cs file. There is a method called GetControlSupport in that file. Check what your controls classname is coming as, and ensure that you return (int)ControlSupport.NativeSupport for that class name.
Note2: This code is not production quality code and has not undergone complete testing. So there might be a few bugs. If you find any issues as such, do ping me, I will do my best to get them resolved.
We have released a QFE after which achieving the above(using UIA instead of MSAA) has become a lot more easier.
Go through http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/24/coded-ui-test-new-extensibility-qfe.aspx to know more about the QFE.
I am attaching a sample project which you can use as a improved/easier replacement for UIAProxy.dll.
Download ProxyPlugins.zip, extract, build the WPFExtendPlugin solution and copy WPFExtendPlugin.dll to %ProgramFiles%\Common Files\microsoft shared\VSTT\10.0\UITestExtensionPackages\ (or %ProgramFiles(x86)%\Common Files\microsoft shared\VSTT\10.0\UITestExtensionPackages\ if it is a 64 bit machine).
If you are already using UIAProxy.dll, do delete it before using this.
If you want to fine tune this further, you need to modify GetControlSupportLevel() method in WPFExtendManager.cs file to return ControlSupport.ControlSpecific support only for the controls of your choice.
I am trying to UIA instead of MSAA for all controls. I downloaded the above sample and followed the instructions above,but then the application is still recording/recognizing controls using MSAA . referred UitestLog.html( %temp%\UItestLogs).however the UitestLog.html shows the overriden GetService() in UIAProxyPackage.cs. At run time, Playback.GetCoreTechnologyManager() from the recorded steps of the application also shows as MSAA. Should I need to override the methods in technologyManager.cs (from attached code) ? please help.
I am using windows 7 with visual studio 2012 - Automating "Outlook 2010" application. I am trying to identify Custom Table view.
I have tried you above steps, but found that after putting the generated dll file to "C:\Program Files (x86)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages" location, when i restart my visual studio 2012 and try to identify the object using "Cross-hair", It doesn't even identify any object ( blue box does not appear).
Before putting this dll it used to identify atleast other object, that also not identified after putting new dll.
How could i resolve it ?
Thanks for you help.
This plugin depends on accessibility, specifically UIA. Any application that doesn't implement accessibility will not be testable using this approach.
We are working on Visual Studio 2012. If weenable the UIa plugin the coded ui test builder is hanging. We debugged and found that the process is stuck at (UITechnologyManager)Playback.GetCoreTechnologyManager("Uia"); in the extension manager. Do we have to install any further prerequisites to work with the extension plugins?
I'm struggling to get Coded UI to work with a WinForm that hosts a custom control (which contains standard winform controls - buttons, text fields etc.)
The winform is owned by a WPF application, which coded UI has no problem locating, and I managed to automate the menu: File > New > Work Item which launches the winform as a new window (owned by the WPF application, as a modal dialog).
However, it fails to find the winform. I've implemented all the ControlAccessibleObject methods, and I can see in UI Accessibility Checker that my UIA tree is complete. However, my MSAA tree is empty, showing only 'root' > '(nothing)', both with role 'Invalid'.
How do I fix this? Isn't having a completely implemented UIA tree enough? Thanks!
I should mention that Coded UI uses UIA technology for the WPF form, but insists on using MSAA to try and locate the winform dialog. I'd be happy to tell it to use UIA instead, but the field is read only...