Unable to access the Child Window

Sep 8, 2010 at 5:03 AM

I would like to know how to acceess the child window. I have the main window and when creating a service, a child window pops up with services in Tree View manner. I am having difficulty in accessing the child window. Can someone please help? I have few test cases where i have to handle the child window but do not know how? Thanks in advance.

 I have tried the following:



   List<White.Core.UIItems.WindowItems.Window> window = MainWindow.ModalWindows();

             White.Core.UIItems.WindowItems.Window childlWindow = OmahaWindow.ModalWindow("title bar");

             if (“titlebar” == null)


                 MessageBox.Show("child window is null");



 It returns child window is null?



Also, I had read on discussion forum that we can get the main window first and then the child window

MainWindow= application.GetWindow("title bar", InitializeOption.NoCache);

ChildWindow = application.GetWindow(“title bar, initializeOption, NoCache);


  if (“titlebar” == null)


                 MessageBox.Show("child window is null");


 Result, child window is null.


Also read the below on the discussion forum but do n ot know how to use it.

List<Window> windows = application.GetWindows(); --- I want to know how do I print the total number of windows retrieved.?

Window childwindow = windows.Where(p=>p.Titel == "Open").First(); - I would like to know what is p=>p.Title is?

Sep 8, 2010 at 6:24 AM



first can you use UISpy or UIAVerify to get an Idea where the child window is located?

parent and  so on.

List of all Windows:

List<Window> windows = application.GetWindows();

Trace.WriteLine("Actual Count of Windows : "+windows.Count);

foreach(Window window in windows)


  Trace.WriteLine("Window name: "+window.Title);


Window childwindow = windows.Where(p=>p.Titel == "Open").First();

this is a linq expression, 

p is an Object of Type "Window",

you can also write


foreach(Window window in windows)


  if (window.Title == "Open")


    return window;




for more info read msdn






Sep 8, 2010 at 12:12 PM
Edited Sep 8, 2010 at 1:03 PM

Thanks for the response. My child window is under the Main window. How should i proceed further after I find the child window. How should i make it active or bring it to focus so that I can perform actions with in the window. For instance, i have services listed in the child widnow in the treeview manner and i want to retrieve a service. Thanks again for all the help. I am actually working on a project that needs to be done with White and i am trying to learn it little by little. Thanks. Also, where is the results for the Trace.WriteLine gets written to.

Sep 9, 2010 at 8:19 AM




I can see Traces in the Nunit window (text output tab), or in VisualStudio resharper sessions


Child Window:


if you have access to the child window and it is not active try




or childWindow.Titelbar.Focus();



Sep 9, 2010 at 4:13 PM

I tried the below

List<White.Core.UIItems.WindowItems.Window> windows = MyApp.GetWindows();

Messagebox.show("Actual Count of Windows : "+windows.Count);

and do not get any messagebox. it is really disturbing that i do not know what i am doing worng. I have a lot to cover on the child window and i am stuck at the same point for few days now. Any other suggestions you or anyone have will be appreciated. Thanks again.

Sep 9, 2010 at 4:16 PM

what does


mainWindow.ModalWindows() return?


is the child window modal?



Sep 10, 2010 at 7:48 AM

Thanks for the response. How do I find out if the child window is modal?

Sep 10, 2010 at 12:45 PM

mainWindow.ModalWindows() returns only modal windows


window.IsModal is the property on a window item