Does CUITe support for accessing controls in a new dialog window

Oct 23, 2012 at 4:02 AM

When I click a button, it displays a new dialog window. Does CUITe support for accessing the controls in this dialog window?

Thank you.

Oct 23, 2012 at 7:56 AM

Yes, it should work.

For examples, you can see the FromProcess_GetWindowTitle_Succeeds and GetBrowserWindow_WithDynamicWindowTitle_CanGetNewWindowTitle unit tests in Sample_CUITeTestProject\BrowserWindowTests.cs from the latest source code.

Oct 25, 2012 at 10:24 PM

I used CUITe_BrowserDialog and it works.

Thank you so much

Jan 16, 2013 at 5:25 AM
Edited Jan 16, 2013 at 5:28 AM

Can you please elaborate how you used CUITe_BrowserDialog here?

How do you access the objects inside the new dialog window?



Jan 17, 2013 at 7:38 AM

Hi Tharinda,

For example, changeset 21564 has two sample unit tests in Sample_CUITeTestProject\BrowserWindowTests.cs as follows:


public void FromProcess_GetWindowTitle_Succeeds()
    CUITe_BrowserWindow.Launch(CurrentDirectory + "/TestHtmlPage.html");

    BrowserWindow bWin = CUITe_BrowserWindow.FromProcess(Process.GetProcessesByName("iexplore").Single(x => !string.IsNullOrEmpty(x.MainWindowTitle)));

    Assert.AreEqual("A Test - Windows Internet Explorer", bWin.Title);


public void GenericGet_WithHtmlControls_GetsControlsDynamically()
    CUITe_BrowserWindow bWin = CUITe_BrowserWindow.Launch("", "Gmail: Email from Google");




Jan 18, 2013 at 3:42 AM
Edited Jan 18, 2013 at 3:43 AM

Thanks icnocop

I tried it and it works and Thanks.  But is it possible to create the instance of the page definition class of the page loaded  to interact with objects/controls in the  new dialog.

For example:

From the current main Browser window, I click a button which will open a child browser window called "Appointment"

Now I need to create the page definition class for this new browser window called "Appointment"

Can I use :

Appointmentpg apppage = CUITe_BrowserDialog.GetBrowserWindow<Appointment>(); 
Appointmentpg apppage = CUITe_BrowserWindow.GetBrowserWindow<Appointment>(); to create the instance? If I do so, I get NPE exception.
It seems you need to issue following command before creating the instance :CUITe_BrowserWindow.Launch(new Uri ("Request to Appointment dialog")
Is there a way to create the instance for such popup dialog with out using Cuite_BrowserDialog.lunch() command?

Thanks and Regards


Jan 19, 2013 at 7:33 PM
Edited Jan 19, 2013 at 7:34 PM

Hi Tharinda,

The following code should work:

T window = CUITe_BrowserDialog.GetBrowserWindow<T>();

Please make sure that you are assigning the variable of the same type used that is passed as the generic type parameter of the GetBrowserWindow<T>() method.

This may be a typo in your code:

Appointmentpg apppage = CUITe_BrowserWindow.GetBrowserWindow<Appointment>();

And so it should be:

Appointment apppage = CUITe_BrowserWindow.GetBrowserWindow<Appointment>();

I'd think you'd get a compiler error though.

Either way, please provide a full stack trace of the exception.

Thank you.