Name Mapping - Extended Find - Changing parent URL
I have a web page deployed to two different environment.
The source codes are exactly the same.
The children (panel, panel (1), etc) of that pageWWWTestCom are the same as pageWWWProdCom.
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 ?
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.
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.
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.
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.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
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