Forum Discussion

Nandhakumar's avatar
Nandhakumar
Occasional Contributor
6 years ago

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

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    .... 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.