Modifying Technology used for identifying control

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.

 

 

Update:

We have released a QFE after which achieving the above(using UIA instead of MSAA) has become a lot more easier.

Go through https://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.

ProxyPlugins.zip