Micro Focus QTP (UFT) Forums
Script failing as the Object name changes for each build - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: Script failing as the Object name changes for each build (/Thread-Script-failing-as-the-Object-name-changes-for-each-build)



Script failing as the Object name changes for each build - Sri - 01-23-2008

Hi Ankur,
We have started using QTP recently in our office.I have started my regression suite with just 5 scripts and I am having difficulty maintaining those 5 scripts as the Object name that QTP assigns is changing for every build.How can I handle this time of scenarios in QTP ?

If you see at the following example. The names are different in 2 different build for the same object.

Build 1:
Code:
Browser("ADMServer Login").Page("ADMServer_3").WebEdit("ADMServerPanel1$ctl03$ctl05$Se_5").Set "100"

Build 2:
Code:
Browser("ADMServer Login").Page("ADMServer_3").WebEdit("ADMServerPanel1$ctl03$ctl05$ct_51").Set "100"



RE: Script failing as the Object name changes for each build - Ankur - 01-23-2008

Use regular expression here... I see only the last four letters/digits are changing in this case.

Go to object repository and change the description to

ADMServerPanel1$ctl03$ctl05$.*


RE: Script failing as the Object name changes for each build - Sri - 01-24-2008

Thank you for the reply Ankur. I had to alter a little bit more inorder for this to work. I changed it to .*\$.*\$.*\$.*


RE: Script failing as the Object name changes for each build - Ankur - 01-24-2008

ok, good. Since we are using $ as a literal character and not as regular expression so u need to escape with \$ and not $