This project is read-only.

Does CUITe support for accessing controls in a new dialog window

Oct 23, 2012 at 5: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 8: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 11:24 PM

I used CUITe_BrowserDialog and it works.

Thank you so much

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

Can you please elaborate how you used CUITe_BrowserDialog here?

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

Thanks,

Tharinda

Jan 17, 2013 at 8:38 AM

Hi Tharinda,

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

 

[TestMethod]
public void FromProcess_GetWindowTitle_Succeeds()
{
    //Arrange
    CUITe_BrowserWindow.Launch(CurrentDirectory + "/TestHtmlPage.html");

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

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

    bWin.Close();
}

[TestMethod]
[WorkItem(608)]
public void GenericGet_WithHtmlControls_GetsControlsDynamically()
{
    //Arrange
    CUITe_BrowserWindow bWin = CUITe_BrowserWindow.Launch("http://mail.google.com", "Gmail: Email from Google");

    //Act
    bWin.Get<CUITe_HtmlEdit>("Id=Email").SetText("xyz@gmail.com");
    bWin.Get<CUITe_HtmlPassword>("Id=Password").SetText("MyPa$$Word");
    bWin.Get<CUITe_HtmlInputButton>("Id=signIn").Click();
    bWin.Close();
}

 

 

Jan 18, 2013 at 4:42 AM
Edited Jan 18, 2013 at 4: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"

Mainbrowser.btnCreatenewAppointment.click()

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>(); 
or
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
Tharinda

 


Jan 19, 2013 at 8:33 PM
Edited Jan 19, 2013 at 8: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.