This project is read-only.

how to recognized particular window

Apr 7, 2010 at 7:59 AM

hi all,

please can u tell me  how to recognized particular window .

suppose if your GUI have 3 window and i need 3 window  but this window doesn't have Automation id and name.

what  i do ?



Apr 7, 2010 at 8:10 AM


If you have access to the developer, they should add name and automationID.

If not




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

and try to identify the windows in the list using window specific elements to identify the windows.




Apr 7, 2010 at 1:54 PM

Actually I want to click the okay button on a message box. So, please can you give me suggestion how I can click the okay button on this message box?

Apr 7, 2010 at 4:34 PM



the normal way is

Window window = application.GetWindows().Where(p=>p.Name == "name").First();

Button button = window.Get<Button>(SearchCriteria.ByAutomationID("id"));




But in your case it is difficult to identify the window.


Are all 3 Windows open the same time?

than search for text on window to be sure you have the correct one.


if you have 3 different Message Boxes at different times and you only want to click the OK button

use the first solution with empty name string