How to identify dynamically changing objects in QTP ?

Consider an example where you are having a tree with nodes [can be folder or directory]. The tree as a whole is designed as a web table and sub-folders again as a sub-web table. It is easy to identify the index of the tree node while recording, but during playback when an additional folder or directory is added the index will be changed. In this kind of situation where the index of the objects changes dynamically, there are two actions to be performed.

  1. Identify the properties of the object
  2. Identify the index at run time

Identify the properties of the object

  • Use object spy
  • Add the object to OR

Identify the index at run time

We can use the following piece of code once the properties are identified

For i = 0 to 1000
set sObjTable = Browser(“Browser”).Page(“Page”).WebTable(“index:=”&i)
If Browser(“Browser”).Page(“Page”).WebTable(“index:=”&i). exist Then
If sObjTable.GetROProperty(“property name that is not changed”) = <Value that is expected> Then
Set sRootFolder = sObjTable

End if
Else
Exit for
End If

Next

In a similar manner, we can identify checkbox and radio button objects whose index changes at run time.

This worked for me, hope it will be useful for you too.

Have questions? Contact the software testing experts at InApp to learn more.

Ready to Build
Something
Extraordinary?

Join 300+ companies who trust us to turn their biggest ideas into market-leading solutions.

Our Global Team
500+ Engineers Worldwide
SOC 2 Certified

Get in Touch with Us

Our Global Team
500+ Engineers Worldwide
SOC 2 Certified

InApp India Office

121 Nila, Technopark Campus
Trivandrum, Kerala 695581
+91 (471) 277 -1800
mktg@inapp.com

InApp USA Office

999 Commercial St. Ste 210 Palo Alto, CA 94303
+1 (650) 283-7833
mktg@inapp.com

InApp Japan Office

6-12 Misuzugaoka, Aoba-ku
Yokohama,225-0016
+81-45-978-0788
mktg@inapp.com
Terms Of Use
© 2000-2026 InApp, All Rights Reserved