Udostępnij za pośrednictwem


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

Comments

  • Anonymous
    July 24, 2011
    Hi , 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. Thanks,

  • Anonymous
    January 16, 2013
    The comment has been removed

  • Anonymous
    January 29, 2013
    Hi, This plugin depends on accessibility, specifically UIA. Any application that doesn't implement accessibility will not be testable using this approach.

  • Anonymous
    April 29, 2013
    Hi, 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?

  • Anonymous
    June 04, 2013
    The comment has been removed

  • Anonymous
    June 04, 2013
    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...