wpfcustom-controlsui-automationwhite-framework

Automated-testing custom WPF third party controls


I am trying to use TestStack white to test a WPF application UI automatically. One of the controls are a third party control that is composed of standard child controls, one of which is a text control that I am interested in.

I try to use the x:Name of that control to find it but getting null. I've read several articles that says custom controls are not naturally supported but a little lost when it comes to solutions.

Can anyone please suggest which direction to go? What are the options?


Solution

  • You're going to need to add an AutomationPeer to your new control.

    See documentation here: https://learn.microsoft.com/en-us/dotnet/framework/wpf/controls/ui-automation-of-a-wpf-custom-control