| || |
Object path changing and descriptive programming
When adding objects to the OR a particular button was stored in the OR as
If I open QTP and press record and click on the button "modules" it is recorded as swfWindow("PROMIS_Home").SwfObject("Modules").Clic k.
This was working fine for a few days now QTP cannot find this button. I checked using Object Spy and it is now being recognised as
swfWindow("PROMIS_Home") => SwfObject("topPanel") => SwfObject("mainToolbar") => SwfObject("Modules").
If I record or try and add it back to the OR it is only recognised as two levels again instead of the 4th level down
I thought I would try some decriptive programming to get around this so I wrote the function below.
This function finds the button and I can return the values using the GetROProperty operation (see msgbox) but get an error when I try to click it.
Any ideas on why I can't click on the button object using this method and also any ideas whey the button is being recognised as 4 levels down in object spy but only 2 levels down when added to the OR
Function GetChildObjectByLabel(parent, childname)
Set ChildObjects = parent.ChildObjects
For i = 0 to ChildObjects.Count - 1
If ChildObjects(i).GetROProperty("text") = childname Then
set GetChildObjectByLabel = ChildObjects(i)
msgbox GetChildObjectByLabel.GetROProperty("swfname path")
set GetChildObjectByLabel = parent