Forum Discussion

krkarthik_info's avatar
krkarthik_info
Frequent Contributor
9 years ago

ExpandableFieldRecordPresenter class error

Hi All,

 

I have a XamDataGrid control in my desktop applications which contains rows of data with specified columns. On expanding each rows, again there is a grid (of class 'ExpandableFieldRecordPresenter') contains rows of data with specified columns.

 

TestComplete shows the extended properties wColumnCount, wRowCount for Expanded grid with error value as below

 

Error: Error
An error occurred.
Possible reasons:
1. The application stopped responding.
2. The application was compiled incorrectly (see the Open Applications topic in the help system).
3. An error occurred in TestComplete.

Technical information:
97 0x80020006 (Unknown name.) Records

 

What I am trying to achieve here is to click the specified row of expanded grid using ClickRowIndicator() method.

 

Can anyone know why it shows errors instead of a value.

 

Thanks in advance.

 

Thanks,

Karthik K R

7 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Is it possible for you to post the code itself that is generating the error?

    • krkarthik_info's avatar
      krkarthik_info
      Frequent Contributor

      Hi Robert,

       

      //Select the 1st Row(Row 0) in Main Grid
      Aliases.w_FS.HwndSource_Shell.Shell.RibbonWindowContentHost.Grid.ItemsControl.ContentPresenter.MainView.Grid.dockManager.SplitPane.ContentPane_1.RawFileTabView.Grid.XamDockManager.SplitPane.TabGroupPane.ContentPane_1.ContentControl.CompositeRawFileView.CompositeContents.dockManager.sp.WPFObject("mzVaultSearchResults").WPFObject("ContentControl", "", 1).WPFObject("MzLibrarySearchResultsWindow").WPFObject("Grid", "", 1).WPFObject("MzVaultSearchResultsGrid").ClickRowIndicator(0);
      aqUtils.Delay(1000);
      
      //Expand the 1st Row(Row 0)
      Aliases.w_FS.HwndSource_Shell.Shell.RibbonWindowContentHost.Grid.ItemsControl.ContentPresenter.MainView.Grid.dockManager.SplitPane.ContentPane_1.RawFileTabView.Grid.XamDockManager.SplitPane.TabGroupPane.ContentPane_1.ContentControl.CompositeRawFileView.CompositeContents.dockManager.sp.WPFObject("mzVaultSearchResults").WPFObject("ContentControl", "", 1).WPFObject("MzLibrarySearchResultsWindow").WPFObject("Grid", "", 1).WPFObject("MzVaultSearchResultsGrid").Expand(0, true);
      aqUtils.Delay(2000);
       
      //Select the 3rd row in sub grid
      Aliases.w_FS.HwndSource_Shell.Shell.RibbonWindowContentHost.Grid.ItemsControl.ContentPresenter.MainView.Grid.dockManager.SplitPane.ContentPane_1.RawFileTabView.Grid.XamDockManager.SplitPane.TabGroupPane.ContentPane_1.ContentControl.CompositeRawFileView.CompositeContents.dockManager.sp.mzVaultSearchResults.MzVaultSearchResultsGrid.ExpandableFieldRecordPresenter.ClickRowIndicator(2);

       

      On select the row in the sub grid returns that error.

       

      Thanks,

      Karthik K R

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        OK, first of all, just a format note... for readability, you might want to compress your Alias pathing for your objects. A lot of the objects and such that you have in the current paths are probably not ones you are going to be interacting with in your automation so it's better to use the Alias feature to your advantage and collapse them down.

         

        That said, the code looks pretty good for the most part. However, it is possible that the 2 second hardcoded delay is not long enough. Rather than using hardcoded delays, you might want to use WaitAliasChild to do a more dynamic way of checking for the object. So... your last section of code I would write as:

         

         

        //Select the 3rd row in sub grid
        Aliases.w_FS.HwndSource_Shell.Shell.RibbonWindowContentHost.Grid.ItemsControl.ContentPresenter.MainView.Grid.dockManager.SplitPane.ContentPane_1.RawFileTabView.Grid.XamDockManager.SplitPane.TabGroupPane.ContentPane_1.ContentControl.CompositeRawFileView.CompositeContents.dockManager.sp.mzVaultSearchResults.MzVaultSearchResultsGrid.WaitAliasChild("ExpandableFieldRecordPresenter", 10000).ClickRowIndicator(2);

        Probably better practice would write code to detect if the object exists before attempting to interact with it. I would do the same for your other code sections as well.... detect if the objects exist using WaitAliasChild rather than using a hard coded delay.

         

        At least, this would be a first step in troubleshooting your problem. It might not fix it directly, but it will at least clean things up a bit and add reliability back into your automation.