Solved
Forum Discussion
tristaanogre
7 years agoEsteemed Contributor
Instead of passing in the object itself, you should pass in two parameters... the parent object of the object you want to wait for, and the string name of the child object.
So, here's your code:
function WaitForConfigObjectExist(parentObject, objectName, maxWaitTime) { var stopWatch = HISUtils.StopWatch; stopWatch.Start(); while(!parentObject.WaitChild(objectName, 500).Exists) { Delay(500); var currentTime = stopWatch.Split(); if(currentTime > maxWaitTime) { Log.Warning(objectName + " not found after " + maxWaitTime + " seconds."); return false; } }
And you'd call it like this
WaitForConfigObjectExists(Aliases.Parent.Tab1, 'button', 10000)