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 sub web table. It is easy to identify the index of the tree node while recording, but during playback when and additional folder or directory is added the index will be changed. In these kind of situations where the index of the objects changes dynamically there are two actions to be performed.

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

Identify the properties of object

Identify the index at run time

We can use 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
Exit for
End If


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

One Response

  1. Great post! I found this article a very informative. The information given in this article about QTP is very useful. Thanks for all the information you provide through this site. Keep sharing nice article like this!

Leave a Reply

Your email address will not be published. Required fields are marked *