This project is read-only.

How to get control of the new window opened

Nov 2, 2009 at 9:24 AM
Edited Nov 2, 2009 at 9:25 AM

Hi All,

I just started using this white tool and i have the following doubt:

My code is like below:

            string path = @"D:\Program Files\RAR\Test\Application.exe";
            Core.Application  app= Core.Application.Launch(path);
            Window win=app.GetWindow("RAR Application");

            Core.UIItems.WinFormTextBox usernamewtb = win.Get<Core.UIItems.WinFormTextBox>(SearchCriteria.ByAutomationId("UsernameTextBox"));

            Core.UIItems.WinFormTextBox passwordwtb = win.Get<Core.UIItems.WinFormTextBox>(SearchCriteria.ByAutomationId("PasswordTextBox"));

            Core.UIItems.Button okbtn = win.Get<Core.UIItems.Button>(SearchCriteria.ByAutomationId("LogonOKButton"));

after clicking on OK button,application is opened with different window title name.How do i get control of this window?

Please help me. 

Nov 4, 2009 at 4:28 PM

Is the new window launched under same process? If yes then you can do app.GetWindow.

If it launches new process completely then you would have to construct the new application object using on of the methods provider in it.

Nov 5, 2009 at 8:43 AM

I was able to get control of the window using the below code:

Window win1 = Desktop.Instance.Windows().Find(obj => obj.Title.Contains("RAR application"));

Thanks vivek,

I will try what u said above.