Custom control, not all inside elements accessible.

Jun 18, 2009 at 7:35 AM


Could you please help me on following:

I've got custom combo-box controls in the application-under-test, the control contains regular combo-box, several buttons and pop-ups.

Using TestAPI I can get access to the regular combo-box and it's ListBoxItems only, but I need to press the buttons and verify pop-up's content.

Is it possible somehow?

Aug 12, 2009 at 5:14 PM

Are you using inproc or out of proc?  Take a look at the source acceptance tests for TestApiWpfAcceptanceTests in v0.3.  In particular, take a look at the WaitForWindowTest on WpfInProcSeparateThreadUnitTests.cs and WpfOutOfProcUnitTests.cs.  They both provide examples on how to press a button that launches another window.  While you want to launch a popup, these examples should at least get you started.

Aug 13, 2009 at 6:25 AM

Thank you for pointing to the useful piece of code, but the question is mainly about accessing custom controls. The point is that inside components of custom controls are "invisible" for UIAutomation (even if they have AutomationId assigned), so it' raises the question how to access such elements using out-of-process approach. Another option would be using either pure in-process or mix of both.

Sep 7, 2009 at 7:45 PM

Same problem here. :(

Sep 7, 2009 at 11:24 PM

Do your custom controls have UI Automation Peer classes? These allow custom controls to be exposed to tests via UIAutomation.

UI Automation of a WPF Custom Control ->

A sample custom control with UIAutomation support ->


I hope that helps