Forum Discussion

KevinStanley's avatar
KevinStanley
Occasional Contributor
3 years ago

Labels not found if URL changes

The web testing that I'm performing has labels on down the left side of the page, which are always available and expand when clicked to show additional sections. When I click one of the sections, the URL changes, but the UI remains the same. If I map a label, it maps it to a specific page, which changes depending on the section I choose. Therefore, if I try to have test complete click one of the labels after the URL changes, the object cannot be found because the parent (the page it was mapped from) is not present. Is there a way to map the labels so that they can be found when the URL makes it look like I'm on a different page?

  • ebarbera's avatar
    ebarbera
    3 years ago

    Hi KevinStanley  - 

     

    Another option is to use conditional mapping, you can allow for the common objects on several different pages by using this option. Please see link for additional information: 

     

    Once you have selected this option you can allow for multiple URLs. 

     

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Try to use wildcards and conditional mappings. Here's an example (not great), using Extended Find, to identify the SmartBear logo in community.smartbear.com and smartbear.com

     

    URL

     

    Object

     

     

    • KevinStanley's avatar
      KevinStanley
      Occasional Contributor

      The issue that I'm running into is it can't find the parent objects if the page is different than when it was mapped. The identifiers appear to be good for the object itself, but since the URL is different, it can't find the parent information it is mapped with. 

  • Yes, I understand that. Did you try using wildcards and it didn't work?

     

    On the page I posted above

    https://support.smartbear.com/testcomplete/docs/reference/misc/using-wildcards.html

    the top section mentions using wildcards in dynamic web pages:

    The URLs of dynamic web pages (see Ignoring Query String Parameters

    And it mentions wildcards in name mapping

    Using Wildcards in Name Mapping

     

    Those sections have information that will be useful for you. Try these out and let us know what happened.

     

  • KevinStanley's avatar
    KevinStanley
    Occasional Contributor

    Marsha,

      For this to work, I would edit the URL property for the page to include a *, correct?

    I should then map all of the labels from that page for them to be available at all times from other pages.

    I think it would cause issues if I were to add a wildcard to all of my pages, since our system seem to use trees that are not very distinct. Right?

    • Marsha_R's avatar
      Marsha_R
      Moderator

      I would try mapping the labels with a wildcard rather than the whole page. Put the wildcard in the part that changes each time.

      • KevinStanley's avatar
        KevinStanley
        Occasional Contributor

        This is the part that it cannot find. How would I add a wildcard to that part of the parent?

         

  • KevinStanley's avatar
    KevinStanley
    Occasional Contributor

    Rraghvani,

      I'll look into that and give it a try if the webpage wildcard does not resolve my issue. Thanks!

  • KevinStanley's avatar
    KevinStanley
    Occasional Contributor

    It looks like a blanket wildcard for the webpage isn't the best answer, although things are working at this time. All new objects are being mapped to the abc.com/* instead of the actual page (abc.com/productspage). I'm testing the conditional mappings for the pages now, Rraghvani.

    • ebarbera's avatar
      ebarbera
      Staff

      Hi KevinStanley  - 

       

      Another option is to use conditional mapping, you can allow for the common objects on several different pages by using this option. Please see link for additional information: 

       

      Once you have selected this option you can allow for multiple URLs. 

       

       

       

  • KevinStanley's avatar
    KevinStanley
    Occasional Contributor

    I think that's the route I'll take. The particular items I'm worried about will be mapped to many pages, which I can just add as I write my tests.