_:n56809d794abc47508f94cc7f30d37e7cxb3
<http://schema.org/text>
"That works.&amp;nbsp; However, two things:1) I&apos;d make the stop time be calculated based upon an input parameter.&amp;nbsp; Instead of hardcoding 10 seconds, make that the input parameter for the user to enter the number of milliseconds to wait.2) MappedChildName needs to be an input parameter as well.&amp;nbsp; Somehow, you need to indicate the name that you want to wait for.3) The problem is that the named child, in the indicated code, must be an immediate child of the&amp;nbsp;your.main.container object.&amp;nbsp; What if it&apos;s not?&amp;nbsp; Somehow you need to indicate the parent that you want to search under4)&amp;nbsp;WaitNamedChild cannot take alias names, only mapped names.&amp;nbsp; If you want to search based upon Alias, you should use&amp;nbsp;WaitAliasChild but then, again, you need to designate the parent.Here&apos;s how I&apos;d re-write it:function fluentWait(parentObject, childName, waitTime){\n    let stopTime = GetTickCount() + waitTime; //wait 10s at max\n\n    do {\n        var obj = parentObject.WaitAliasChild(childName, 100);\n    }\n    while(! obj.Exists &amp;amp;&amp;amp; GetTickCount() &amp;lt; stopTime);\n}"
<https://community.smartbear.com/discussions/testcomplete-questions/how-to-create-custom-script-for-dynamic-wait-for-desktop-and-web/247776>