Getting Started with WHITE .NET/WPF Automation Framework

Getting Started with WHITE .NET/WPF Automation Framework

White Framework .Net WPF

Are you a QTP engineer that has often wished there was a way to automated .NET and WPF applications using Visual Studio and C# rather than QuickTest Professional? Do you need to automate a thick client application like WPF, Silverlight, Win32 or WinForms? If so, then WHITE might just be the automation framework for you.

Unlike QTP, which limits you to using VBScript, White allows you to create tests in whichever .NET language you wish — in an IDE that you already use. All this in free open source software — how sweet is that?

Okay. Sounds good so far, but which controls/technologies does it support?

White runs on top of the .NET UI Automation framework. (And just like with QTP, if your application uses third party controls you’ll want to verify that WHITE supports them.) White also supports 32 and 64 bit Windows. For more info on what White support check out: Is White the right choice?

Sample .NET Application

I will be using a small .NET sample application I created in Visual Studio 2010 and creatively named.


Before we can start automating our application we’ll need a way to spy on the application’s fields in order to get the identification properties we’ll need to use in order for them to be recognized by WHITE. For this example, I’ll use the UI Spy that’s installed with the Microsoft Windows SDK. It’s located in the \bin folder of the SDK installation path (uispy.exe), or can be accessed from the Start menu (Start\All Programs\Microsoft Windows SDK\Tools\UISpy).

If you start up the test application, then start UI Spy you’ll see all the test application’s controls in the UI Spy’s Control View. The application will be in a tree view. Navigating through the tree view will reveal all your objects along with their properties that can be seen:

Installing the White Automation Framework using Visual Studio

  • First, navigate to the White Downloads page and grab the latest release.
  • Create a folder named White on your local drive and extract the downloaded zip files to it.
  • Open up Visual Studio and create a new .NET Framework 3.5 console application named WHITE.

    • In your new project, go to the Project>Add Reference menu option.
    • Click on Browse and add the White.Core.dll.

  • Add the following namespaces
    using White.Core;
    using White.Core.UIItems;
    using White.Core.UIItems.WindowItems;
    using White.Core.UIItems.WindowStripControls;
    using White.Core.UIItems.MenuItems;
    using White.Core.UIItems.TreeItems;
    using White.Core.UIItems.Finders;
    • To start an application, you must to use the Application.Launch method:
    Application application = Application.Launch(@"D:\Debug\JoeColantonioSampleApp.exe"

    • You can verify that your app has started by using the GetWindow method:


    Window window = application.GetWindow("JoeColantonio.Com Sample .Net App");

    • As with all automation tools, nothing will be very reliable if you don’t use some sort of synchronization method to ensure your window/field is active before proceeding. To do this in the WHITE framework, you can use the WaitWhileBusy method:
    • Now we can interact with the fields in our application. Everything in White is a UIItem and has different subclasses that map to corresponding controls. So, to enter text into my application’s Patient Name field, I would use the UIItem TextBox control type:
    var patName = window.Get(SearchCriteria.ByAutomationId("txtPatient"));
    • When using WHITE, there are a few methods that can be used to identify objects in your application. The one I use most often is the ByAutomationID.The AutomationID is the programmatic ID assigned by the developer of the application. In Visual Studio this would be the Name property under the Design section:


    The completed script for entering data in all my application’s fields looks like this:

    static void Main(string[] args){
      Application application = Application.Launch(@"D:\Debug\JoeColantonioSampleApp.exe");   Window window = application.GetWindow("JoeColantonio.Com Sample .Net App");           window.WaitWhileBusy();
    var patName = window.Get(SearchCriteria.ByAutomationId("txtPatient"));
    var p = window.Get(SearchCriteria.ByAutomationId("cboProvider"));
    p.Select("Crusher, Beverly");
    var dept = window.Get(SearchCriteria.ByAutomationId("cboDepartment"));
    var apptType = window.Get(SearchCriteria.ByAutomationId("cboApptType"));
    var schedType = window.Get(SearchCriteria.ByAutomationId("rdoSchedule"));
    var button = window.Get

    A Simple Example and the Future of White

    This was a simple example to give you a taste of what can be done using the WHITE framework. I’ll admit that I haven’t tried it on a real-world application so at this stage I’m not sure how robust it really is.

    I also have concerns about how often this open source project is updated. The last release was the August 1, 2011 version 0.21, so development and enhancements for this project have been inactive for some time.

    The good news is there’s a good chance that activity will soon increase on WHITE since it was recently acquired by TestStack.

malay - April 15, 2013

Hi Joe,
Just logged in to ask you some open source tool to test windows applications, and see, I found this post.:-)you know it all.All thanks to you.
I am grateful.


    Joe Colantonio - April 18, 2013

    malay » Cool :) Nice the hear from you Malay!

malay - April 20, 2013

Hi Joe,

There is very less documentation available for White.Moreover,i dont see any of the DLLs mentioned in your post for White.Can you please suggest some good reading.

malay - May 1, 2013

Gentle reminder Joe.Waiting for a response.

Help ! Help !

int - May 4, 2013

you have to install White through from NuGet using the command:
PM> Install-Package TestStack.White

Here’s some other sites you should check out:

pawan - May 6, 2013

Thank you very much , after reading this post really it helped in understanding the concept

    Joe Colantonio - May 8, 2013

    pawan » Awesome – glad it helped!

Ahad - May 27, 2013

Hi Joe when i’m trying to run my application by calling application.launch it is giving me an error message APPLICATION CANNOT EXECUTE WITH READ_ONLY ACCESS RIGHTS , do you ever encounter such rights issue.

    Joe Colantonio - September 2, 2013

    I have not seen this – have you resolved the issue?

Lam Ho - July 8, 2013

I use your method to get Lync Basic 2013 of Microsoft. However, it can’t get a instance of an object . it was stated “Object reference not set to an instance of an object.”

Do you have any suggest about this issue?

samy - July 31, 2013

great post, it help me a lot.
I have a Qustion:
can I make a test script to a 3third party app, without knowing the name of the controls veriables/objects?

    Joe Colantonio - September 2, 2013

    Hi Samy – sorry for my late response. Did you resolve this? Not sure I understand your question – are you saying that you are unable to find a unique id to use to identify the fields in the application?

Pranjal R Nigam - February 5, 2014

Hi Joe,

As shown above you have applied an ‘.exe’ in the ‘Application.Launch’. What should I do if I have a ‘.xbap’ URL?

Pranjal R Nigam

[BLOCKED BY STBV] 18 : Joe Colantonio : The Top 5 Non-Selenium Test Tools You Need to Know About - August 31, 2014

[…] Getting Started with WHITE .NET/WPF Automation Framework […]

omar - September 5, 2014

Hello, when i try to invoke an application to automate, it throws an exception because application is already open. what is the solution to this problem?

Venkatesh - April 7, 2015

i cant able to find the dll’s in the downloaded file.. can u provide me the correct link to download the dll files

    Joe Colantonio - April 7, 2015

    They moved the project to github: You can also install from Visual Studio using NuGET
    Install TestStack.White from NuGet:

    PM> Install-Package TestStack.White

Ananth - May 10, 2015

Hi Joe,

I was having trouble automating the third party controls such as Farpoint spread for .Net. Just wondering if you could advise me on how to proceed. Because, spy tools such as VisualUIVerify, Spy++ tools do not recognize this control.

Thanks in Advance,

Hawk Wang - November 26, 2015

Nice job!
Just want to know how to make such kind of test.

I am grateful.


Akram - June 24, 2016

White framework cheat sheet. Hope it is helpful for everyone.

Sobi - October 20, 2016

How can I handle SaveFileDialog and OpenFileDialog in white?

Click here to add a comment

Leave a comment: