Forum Discussion

raimuxz's avatar
raimuxz
Occasional Contributor
9 years ago
Solved

How to identify mapped objects when testing web page in NameMapping?

How to identify mapped objects when testing web page in NameMapping? The problem is that for several units the same path or class is used. So combined properties do not work. If I use full path name then it takes also version what is not correct for my test cases as it won't work on newer version testing. Is it possible to create some identification by my self for each tested unit in NameMapping? Or is there any other solution?

  • One of the things I use in such cases is:

    If the IMMEDIATE parents of these objects can be easily identified, I map the element with simple characteristics (e.g. contentText in this case) and keep the Extended Find flag unchecked. That way even though there might be several elements on the page with the same text, the search is limited within that parent. See if that works for you.

     

    If not, include a screenshot of the application if possible in your reply.

9 Replies

  • If you want to use NameMapping you'll have to find a novel way to uniquely identify the given objects. Using conditional name mapping can usually help.

     

    For me I can find a way to uniquely NameMap ~99% of the web objects I've had to test. For the rare ones that I can't I just use FindChildByXPath on the closest parent object that is namemapped.

     

     

    • djadhav's avatar
      djadhav
      Regular Contributor

      Please share some details/screenshots showing properties of objects that you are describing. It'll help in a quicker resolution.

  • raimuxz's avatar
    raimuxz
    Occasional Contributor

    Thanks for replies.

     

    I have attached screenshot of properties of two different components which are reached in different ways. A lot of components have the similar properties. I have tried to combine by path, class, name, text but some of them are the same for components which are reashed in different ways.

     

    From my understanding the help would be if TestComplete properties also would show Xpath. In my case every component would be identified.

     

    E.g. The first component has Xpath: /html/body/div[20]/div[3]/ul/li[2]

    The second component has Xpath: /html/body/div[34]/div[2]/ul/li[1]

     

    Is any other solution for this case?

    • baxatob's avatar
      baxatob
      Community Hero

      Check other properties. As I can see, your components have different values for the contentText property.

      Also you can identify them by id, if that property is not dynamic. 

       

      And, as ghuff2 said, you can use FindChildByXPath Method. The only thing is better not to use the absolute xpath, but use the expressions instead.

  • raimuxz's avatar
    raimuxz
    Occasional Contributor

    Content text differs only in this case. It is not an option because I have some components with the same content text but different calss or path or smth else. When there are a lot of such components they are not find by executing tests.

     

    Regarding ID I am not sure from where it comes as there is no ID in web code. Is it specific ID generated by TestComplete. Can it be unique for each created component?

     

    To use FindChildByXPath method I need to create all test case as script. Am I correct? Because at the moment I recorded test case using "Record Keyword Test".

    • djadhav's avatar
      djadhav
      Regular Contributor

      One of the things I use in such cases is:

      If the IMMEDIATE parents of these objects can be easily identified, I map the element with simple characteristics (e.g. contentText in this case) and keep the Extended Find flag unchecked. That way even though there might be several elements on the page with the same text, the search is limited within that parent. See if that works for you.

       

      If not, include a screenshot of the application if possible in your reply.

  • raimuxz's avatar
    raimuxz
    Occasional Contributor

    Thanks for reply.

     

    I am adding a screen shot of web page. It is very simple. Results depend on what was entered in other system. But there can be diferent types and the same screen can be reached by different ways. Please take a look may be you will suggest something from your experience how it is better to test it.

     

    I have tried to uncheck "Extended Find" for such components. I tried with few ones and seems to be working.

    • djadhav's avatar
      djadhav
      Regular Contributor

      I'm glad to know it seems to be working. What exactly do you test on that page?

      • raimuxz's avatar
        raimuxz
        Occasional Contributor

        On that screen I am checking if record is added or not when I am adding it (or not) from other screen.