- December 12, 2011
- Posted by: Anjana V K
- Category: Testing
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.
- Identify the properties of object
- Identify the index at run time
Identify the properties of object
- Use object spy
- Add object to OR
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
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.