Forum Discussion

sameerjade's avatar
sameerjade
Frequent Contributor
7 years ago

Aliases vs Full Name (Full Name not working but Aliases is working in some cases)

Hello,

 

I used the object spy on a window in our desktop application. From the object spy information, if I use the FullName, it always fails because it fails to find a certain component in the FullName path. If however, I use the Aliases name, it passes. 

 

Error: Unable to find the object QtObject("ContainerLeft"). See Additional Information for details.

 

Aliases: 

Aliases.ABC.MainFrame.TopWidget.HorzExpandingStrip.splitter.widgetExpander.ContainerLeft.ImportNavPanel.mpTabWidget.qt_tabwidget_stackedwidget.mpSetupsTab.Hds_GuiUtils_TreeWidget.TreeView.qt_scrollarea_viewport

 

FullName:

Sys.Process("ABC").QtObject("MainFrame").QtObject("TopWidget").QtObject("HorzExpandingStrip").QtObject("splitter").QtObject("widgetExpander").QtObject("ContainerLeft").QtObject("ImportNavPanel").QtObject("mpTabWidget").QtObject("qt_tabwidget_stackedwidget").QtObject("mpSetupsTab").QtObject("Hds::GuiUtils::TreeWidget", "", 1).QtObject("QTreeView", "", 1).QtObject("qt_scrollarea_viewport")

 

Has anyone else seen this issue?

 

Thank you.

 

Regards,

Sameer

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    By "use the Full Name", what are you actually doing.  Also, how are things mapped out?  

     

    Keep in mind, Alias goes through the NameMapping engine to identify objects.  There may be things like "Extended Find" turned on to help find an object that may not be a direct child.  

     

    Generally speaking... it sounds like you have object identification issues.  I'd start going through your NameMapping tree and seeing if you need to clean up or correct some improperly identified objects.  I'd start with what is mapped as ContainerLeft, check what properties are defined on that object in your mapping, correct them if need be.  Then, I'd start looking at the parent objects in your NameMapping tree to see if they need to be adjusted as well.

     

    One thing to be aware of... you should NOT be using FullName as a property for NameMapping... it defeats the purpose of NameMapping by bypassing the engine completely.  If your objects are using FullName, find an alternative.

    • sameerjade's avatar
      sameerjade
      Frequent Contributor

      By "use the Full Name", what are you actually doing. 


      I want to access certain objects inside a window (although object spy is not able to catch/highlight these objects at this point, which seems to be a separate issue. This window does not show any children in the object spy information window which seems to indicate that the objects that I am trying to highlight are not really objects for TestComplete. Have not found a solution to this problem so far..sorry for digressing), therefore I am saving the window definition inside a variable. Then I call methods like Click(), ClickButton() on my variable. Now if I set the variable to the FullName of the window, it fails because it cannot find ContainerLeft but if I set the variable to the Aliases name, it works. Note that "ContainerLeft" is present in both FullName and the Aliases name.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        One thing that aliases do that the full name doesn't is that there's this auto-wait timeout that happens with an aliased/name-mapped object.  If there is functionality occurring before your call to that variable that causes the ContainerLeft to appear, using the FullName may not always work because the object may not be instantiated at the moment you make the call.  Using the Alias, TestComplete does it's mapping engine to search down the tree to find the object, checking at each level and using the auto-wait timeout.

         

        As for why Aliases may not work 100% of the time, the auto-wait time out may not always be sufficient for the amount of time for the object to appear.  By default, I think TC sets this to 10 seconds.  You can either bump up the auto-wait timeout for your project or make use of the various WaitNNN methods (search the online documentation for WaitNNN) to actually apply dynamic wait processing to your object identification.