Forum Discussion

baxatob's avatar
baxatob
Community Hero
9 years ago
Solved

Name Mapping in the Web module

Hi,

 

I have installed a web-module, previously I was working only with desktop.
I am testing a web application. Application starts from the dashboard, which contains a main menu in the header.

Header contains a number of elements, which are common for each page. As example it's a link "Logout".

 

This element was mapped as: Aliases.dashboard.header.linkLogout

 

But if I want to use this element from another place of application, say from the some Menu_1 or Menu_2, I can't do it, because TC recognize each page of menu as a new parent page. So I should map "Logout" link for each page to use it there, like:

Aliases.menu_1.header.linkLogout or Aliases.menu_2.header.linkLogout etc.

 

I am looking for the way to avoid creating of redundant aliases for the same elements. 

 

Please give me the direction how to do it.

 

Many thanks!

 

P.S. As a workaround I use the FindObject method by XPath, but it does not store the element in the name mapping repository.

  • If I understand your problem correctly, what you need is to do is to have a general parent. So besides mapping page_1, page_2 etc., you have a mapping that covers any page and put the children that exist on all your pages under that. When you try to do that, you will see that it tells you "I cannot map this object, because it is already mapped", but you just go in manually and edit this mapping so that it "breaks", do your general mapping, and fix the other mapping manually again. Then you just have to make sure that the children you want under the specific parents end up under them and the ones that should go under the general end up under that.

     

     Hope this solves your problem.

5 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Baxatob,

     

    Take a look at the Aliases.menu_1 object criteria. You need to modify them by adding unique properties that will identify the object for sure. Please see the Modifying Mapping Criteria ( http://smartbear.com/viewarticle/70319/ ) article for details.

    • baxatob's avatar
      baxatob
      Community Hero
      Dear Tanya,

      Thank you for your reply.

      Yes, I know how to modify object properties. But in my case all similar elements have absolutely identical properties. Only one difference - they have different parent objects. May be TC provides a solution to have ONE mapped object with predefined properties for all elements, which have these properties?
      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Hi Baxatob,

         

        In this case, it makes sense to try using NameMapping’s Required Children feature. Please read the Specifying Required Child Objects ( http://smartbear.com/viewarticle/72258/ ) article for details. Is this what you are looking for?

  • sha's avatar
    sha
    Contributor

    If I understand your problem correctly, what you need is to do is to have a general parent. So besides mapping page_1, page_2 etc., you have a mapping that covers any page and put the children that exist on all your pages under that. When you try to do that, you will see that it tells you "I cannot map this object, because it is already mapped", but you just go in manually and edit this mapping so that it "breaks", do your general mapping, and fix the other mapping manually again. Then you just have to make sure that the children you want under the specific parents end up under them and the ones that should go under the general end up under that.

     

     Hope this solves your problem.

    • baxatob's avatar
      baxatob
      Community Hero
      That is absolutely what I need!

      Many thanks to all of you!