Is There A Wait Method for FindChild?
I use the FindChild method to search a web page and return the object if it exists. My code to do this is as follows. I'm wondering if I could use a native Wait method instead of the code I have to wait for the object to exist? Could I make use of WaitChild maybe?
Any idea would be welcome.
Thanks,
John
Public Function GetObjectbyID(idStrName,pg)
Dim iLoop,PropArray,objTemp
Log.Message "Starting the GetObjectbyID function"
PropArray = Array("idStr")
ValuesArray = Array(""&idStrName&"")
Set objTemp = pg.FindChild(PropArray,ValuesArray,100,True)
iLoop = 0
Do While NOT(objTemp.Exists) AND iLoop < 10
aqUtils.Delay 1000
Log.Message "GetObjectbyID: Object not found on attempt " & iLoop
Set objTemp = pg.FindChild(PropArray,ValuesArray,100,True)
iLoop = iLoop + 1
Loop
If objTemp.Exists Then
Log.Message "GetObjectbyID: Object returned with ID:" & idStrName
Set GetObjectbyID = objTemp
Else
Log.Error "GetObjectbyID: Object not found with ID:" & idStrName
Set GetObjectbyID = nothing
End If
'Destroy objects
Set objtemp = nothing
End Function