TopLevelElement property is null on document control for web application. RRS feed

  • General discussion

  • Hi,

    On VS2013 update 4 we are seeing issue where as  it is not coming on VS2013 update 2. TopLevelElement property on document control is coming as null. The code is as shown below.


               UITestControl doc = this.UISampleWebApplicationWindow.UISampleWebApplicationDocument;
                UITechnologyElement tech = (UITechnologyElement)doc.GetProperty(UITestControl.PropertyNames.UITechnologyElement);
                if (tech.TopLevelElement == null)
                    //it is a regression in CUIT


    Could you please check and let us know the solution?




    Thursday, March 19, 2015 11:08 AM

All replies

  • Hi Nagasree,

    If you remove the update 4, could you run your test successfully?

    Could you share us  a simple sample? So we could really repro this issue in our side.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 24, 2015 9:11 AM
  • Hi Jack,

    You can reproduce this issue with any html sample application.

    >> Open link: https://www.google.co.in/

    >> Click on any control

    >>Then modify code as shown in below

    ******************************* Code *****************

         HtmlEdit uISearchEdit = this.UIGoogleInternetExplorWindow.UIGoogleDocument.UISearchEdit;
                UITestControl htmlDoc = this.UIGoogleInternetExplorWindow.UIGoogleDocument;
                UITechnologyElement tech = (UITechnologyElement)htmlDoc.GetProperty(UITestControl.PropertyNames.UITechnologyElement);

                if (tech.TopLevelElement == null)
                    System.Windows.Forms.MessageBox.Show("Bug in VS 2013 +update 4");


    Issue seen only with update 4. Look like it is bug in latest release. It working fine in Update 3



    • Edited by Rajendar M Tuesday, April 7, 2015 8:35 AM
    Tuesday, April 7, 2015 8:33 AM