Window with no title

Aug 25, 2011 at 1:28 PM
Edited Aug 25, 2011 at 2:39 PM



I'm trying to automate an application using White.

The problem i'm facing is that the application does not have a i can't access the window with



I verified with UISpy that the window does not have  a title.

Is there any way to getwindow, by name for instance?

Aug 26, 2011 at 12:12 PM



there are more ways.Has the window an automation ID?


List<Window> windows = this.application.GetWindows() // gets all windows of these applikation


now search the window in the list : if there is no other with title =""

Window emptyTitle = windows.Where(p=>p.Title == "").First();

or if automation ID exists =>

Window emptyTitle = windows.Where(p=>p.AutomationElement.Current.AutomationID == "auID").First();



Aug 26, 2011 at 3:37 PM

Sometimes there are hidden MS windows with no title as well, so you could also try searching by a Process Name. Just look at the Task Manager to see what your app's Process Name is and then you can do something like this:

public static Window GetWindowByProcessName(string imageName)
            //store all processes with name matching processName into a List
            List<Process> matchingProcesses = new List<Process>();

            foreach (Process p in Process.GetProcesses())
                    if (p.ProcessName == imageName) // if the image name is found match the process id and return a Window
                catch { }
            } // end loop of processes

            //find the FIRST occurence of the Window with matching imageName (this will be the most current Window that had focus)
            List<Window> windows = GetAllWindows();
            int imax = windows.Count;

            for (int index = 0; index < imax; index++)
                foreach (Process p in matchingProcesses)
                        if (windows[index].AutomationElement.Current.ProcessId == p.Id) return windows[index];
                    catch { }
            } // end loop of Desktop Windows

            return null; // if this is reached, then the window wasn't found

        } // GetWindowByProcessName

Aug 26, 2011 at 3:47 PM

Thanks wwarwood and Throndorin,

It does not have an automationid.

I think i can get the window by the name

White.Core.Desktop.Instance.Windows().Find(obj => obj.Name.Contains("nameofapplication"));