Question

I am trying to automate UI interactions for a C++ MFC application. I tried to find elements' automation ID using UISpy and UIAVerify tools. I am on win2k3.

There is a tab control, the automation ID of which is visible to UISpy but not to UIAVerify.

The issue is - it is not visible even to the C# code that I write using Project White framework or ui automation framework of .net 3.0.

I want to get handle to this control the way UISpy gets it. Is there any way I can find out how UISpy does it?

Thanks!!!

Was it helpful?

Solution

UISpy is likely using Microsoft UI Automation under the covers. You can see how this works from this example*. There are all kinds of conditions on AutomationElement which you can use to locate them.

I've only worked with WPF tabs, but found it really, really hard to locate them by Automation Id. Instead I've been using the AutomationName property, with the title on the tab as the value. Not sure if White supports this, but I'm pretty sure you can get the original AutomationElement out and use it as per the example.

You'll also probably be looking for something supporting the SelectionItemPattern (there's a SelectionItemIsSupportedProperty), and you'll need to use the pattern to select the tab and make it active before you can see anything in it.

Please comment if you need any more info. It might help to know what the structure of your container with tabs in is.

*Declaration of interest since I wrote this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top