cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of Regular Expressions for scripting dynamic object identification using VBscript

Occasional Contributor

Usage of Regular Expressions for scripting dynamic object identification using VBscript

Hi Team, I have been using TestComplete and TestExecute for running regression suite for my application. I am using Object browser to identify the exact object that I need for my scripting and add them into my script. I am using VBScript for coding the scripts. The objects will be present with multiple panels in the application and the Mapping Hierarchy would be something like this. 

 

Aliases.browser.AppName.Panel(5).Panel(1).Panel(0).Panel("UserPopup").Panel(0).Panel(0).Panel(Popup_Title).TextBox

 

The number of panels may increase or decrease in different pages and the panel number within the parenthesis seems to be dynamic. Hence, Even If I save the above hierarchy in the name mapping, When I change the input values, the objects would not get identified and the script would fail. 

 

Expected Name Mapping: 

Aliases.browser.AppName.Panel(*).Panel(*).Panel(0).Panel("UserPopup").Panel(0).Panel(0).Panel(Popup_Title).TextBox

 

I request your suggestions on how to replace the panel numbers within paranthesis with regular expressions or there is a way to identify the required object consistently with much smaller names. Kindly do the needful at the earliest. 

2 REPLIES 2
Community Hero

Re: Usage of Regular Expressions for scripting dynamic object identification using VBscript

.... you don't.

You map each panel in the Mapped Objects panel of NameMapping, choosing properties that are non-dynamic to clearly identify the panel.  Things like contentText, classname, etc., in combination can help with this.

 

You could also apply an "Extended Find" to the Panel(Popup_Title) (again, mapping Panel(Popup_Title in such a way to identify it properly) and completely remove all the other panels from your list.  You'll take a bit of a performance hit but, depending upon your situation, that may work best.

Regardless of which way... your ALIAS does not have to match the Mapped object.  You can excluded unneeded panels from your Alias so that it is simplified for the object usage within your automation.


Robert Martin
[Community Expert Group]
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
Extensions available
Community Manager

Re: Usage of Regular Expressions for scripting dynamic object identification using VBscript

Hi @Nandhakumar,

 

Several years ago, we recorded the videos explaining how to use TestComplete to test dynamic objects. A lot of great features were added to TestComplete since that time. However, I think it will be useful to watch the video to understand the main concept:

https://support.smartbear.com/screencasts/testcomplete/reliable-tests-for-dynamic-objects/

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview