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

  • JuliaBernikova's avatar
    JuliaBernikova
    SmartBear Alumni (Retired)

    Hi Sameer,

     

    You wrote:

     

    >>>

    ... it fails to find a certain component in the FullName path. If however, I use the Aliases name, it passes.

    <<<

     

    The behaviour you describe is quite expected - the Name Mapping repository (including the Aliases tree) is supposed to help you avoid problems with using object full names. Thus, it looks like the QtObject("ContainerLeft") object is kind of dynamic: it may either disappear from the tree or appear in a different place which makes the FullName property you copied before invalid. I suggest that you keep using Aliases to refer the application objects. If you encounter any issues, let us know!

    • sameerjade's avatar
      sameerjade
      Frequent Contributor

      Thank you Julia!

      A follow-up question - is it always recommended to use the Aliases name and not use the Full Name?

       

      Regards,

      Sameer

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        If you have Aliases and mapped objects, it's always better to use that... Aliases and NameMapping have a lot of behind the scenes helpers that make finding dynamic objects, objects that may not appear immediately, etc., work better.