Forum Discussion

coffee's avatar
8 years ago

Name Mapping - Extended Find - Changing parent URL



I have a web page deployed to two different environment. 


The source codes are exactly the same. 


When I write JS script for, in NameMapping section -- Mapped Objects window, I can see pageWWWTestCom under browser.  The same thing when I write script for 

The children (panel, panel (1), etc) of that pageWWWTestCom are the same as pageWWWProdCom. 



Currently, after I finish writing JS script for and it runs fine in , I need to change the aliases in my script so I can re-use it and run it in 

That takes time. 


I am just wondering, why can't we use extended find and drag all those children (panel, panel(1), etc) directly to be under browser, so I don't need to change the aliases in my script. Because all the children are the same, the only difference is just the parent URL.  


Is there any other good method that I can use , so I don't need to keep changing the aliases in my script every time the parent URL change ? 


Thank You. 




5 Replies

  • Presume you must be using the URL as an identification property for the page object?


    If it is the only browser open during your test, you should be able to simply wildcard it out.


    So instead of the property ID being "" or "" change it to "www.*.com". Or simply "*". Which means it would run on any site.


    Or you could store it as a variable. Read it in from an INI file of some description. Include it in the input if you use data and/or keyword driven tests (that's what I do). If there is anything else in the deployment which changes, and can be accessed before starting the site, you could inspect that and use the result to determine the URL path to use.


    Probably quite a few options.

    • coffee's avatar

      Thanks All. 


      I managed to do "Extended Find" , so I just skip the pageURL and I put all elements directly under Sys-Browser. 

      I also tried to wildcard the URL , www.*.com.


      The problem with those solutions is TC tends to take much more time and the playback process becomes much much slower when I have heaps of open Chrome tabs. I think TC doesn't know in which tab does this web element sit and it needs to search in each and every tab. Sometimes it took 5 minutes just to find the box and it returns


      Searching for the mapped object "WarningBox" took a long time. This happened because the sought-for object has the Extended Find attribute enabled, and the test engine searched for this object on all levels down the object hierarchy.


      To speed up the search and improve the test performance, add more parent objects of this object to the Mapped Objects tree of Name Mapping.


       Anyway, thanks for all the suggestions :smileyhappy: 



  • shankar_r's avatar
    Community Hero

    You can use Project variable as your identification property. So you can set your URL whatever you want for different environments.


    For this, Instead of constants you should select project variable in Edit identification properties.


    This needs to be set before you access the particular object.


    • tristaanogre's avatar
      Esteemed Contributor

      All ideas presented are very good ideas, depending upon what you want to do.  That's, again, one of the bonuses of using NameMapping in that you can map something like your main page URL to be dynamically determined either using a wildcard, a project variable, using a conditional mapping, etc. Anyone of those ways would allow you to test, regardless of environment, without having to change your Alias... a simple commandline switch or, as mentioned, INI configuration could trigger the use of a different environment and then the Alias could account for it.