Custom UIAutomation providers for non-WPF controls

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Custom UIAutomation providers for non-WPF controls

Post by Support Team » Mon Feb 07, 2011 2:33 pm

For an overview on UIAutomation see this wiki page.
This blog provides a sample for a custom UIAutomation provider.

Microsoft’s UISpy looks specifically and only at the UIAutomation interface of an application. Ranorex Spy on the other hand interfaces MSAA through an according plugin, but not UIAutomation directly.
UIA is used to interact with WPF controls only, but there is no plugin for UIAutomation alone.

Therefore custom UIAutomation is not fully supported on non-WPF controls.
But every UIAutomation-enabled application automatically also provides the MSAA interface. The number of properties are reduced, though. From the remaining MSAA properties the Ranorex Plugin filters out those that are not important for the GUI automation.

The amount of filtering is reduced a bit in Ranorex 3.0 with respect to Ranorex 2.3.x.
There is a way to disable the filtering through code:

Code: Select all

MsaaFlavor.Instance.FilterEnabled = false;
However, for this to work with Ranorex Spy, one needs to create a simple plugin and add the code there.
Read the following forum entry for more on this.

Regards,
Roland
Ranorex Team
.
Image

alex.arseneau
Posts: 2
Joined: Wed Oct 01, 2014 4:06 pm

Re: Custom UIAutomation providers for non-WPF controls

Post by alex.arseneau » Mon Nov 17, 2014 3:10 pm

Is this still the case? Or is UIA now fully supported by Ranorex. I am asking because I need to add accessibility to MFC Property Grid Controls in order to automate interacting with them (the standard CMFCPropertyGridCtrl class does not come with Accessibility implemented, nor does Ranorex have a custom adapter for it), and if only MSAA is supported then I can only query the control for content and not actually interact with it.

Without UIA support I am left with only GDI to interact with a complex control like the MFC Property Grid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Custom UIAutomation providers for non-WPF controls

Post by Support Team » Wed Nov 19, 2014 5:56 pm

Hi Alex,

As long as the setting "Provide elements for non-WPF windows natively implementing UIA" is enabled you should be able to identify your non-WPF controls via the WPF/UIA plugin.
You can find the setting in the WPF section of the Plugins tab:
Setting.png
Setting.png (61.65 KiB) Viewed 2014 times
Regards,
Markus
.
Image