Description
This method delays script execution until the specified child object appears in the child list or the specified time limit is reached. It then returns the child object if found, else an "empty" object. To determine whether the returned object exists in the system, call Exists
.
Declaration
TestObj.WaitChild(ChildName, WaitTime)
TestObj | A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section | |||
ChildName | [in] | Required | String | |
WaitTime | [in] | Required | Integer | |
Result | Object |
Applies To
All processes, windows, controls and onscreen objects.
View Mode
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
Parameters
The method has the following parameters:
ChildName
The name of the child object. This should be the name displayed in the Object Browser panel (in the Name field of the Properties pane).
You can use wildcards (* and ?) in child names. This may be useful if the name of a child object, e.g. a window, changes from one application run to another. To specify an asterisk as part of the name, duplicate the asterisk character (**).
WaitTime
The number of milliseconds to wait for the specified child. If WaitTime is 0, the method does not wait and returns immediately. If WaitTime is -1, the waiting time is infinite.
Note: | If you are testing an open application, the WaitTime parameter is required. In case of a non-open application, the WaitTime parameter is optional and has the default value 0. |
Result Value
The child object with the specified name. If the specified object does not exist, the method returns an “empty” object.
Example
The following code finds whether an object has a specific child.
JavaScript, JScript
if (Obj.WaitChild(ChildObjectName, 0).Exists)
// Child object exists
else
// There is no such a child
Python
if (Obj.WaitChild(ChildObjectName, 0).Exists):
# Child object exists
else:
# There is no such a child
VBScript
If Obj.WaitChild(ChildObjectName, 0).Exists Then
' Child object exists
Else
' There is no such a child
End If
DelphiScript
if Obj.WaitChild(ChildObjectName, 0).Exists then
// Child object exists
else
// There is no such a child
C++Script, C#Script
if (Obj["WaitChild"](ChildObjectName, 0)["Exists"])
// Child object exists
else
// There is no such a child
See Also
WaitNamedChild
Child Method
Find Method
FindAll Method
FindChild Method
FindAllChildren Method
FindId Method
Name Property
Exists Property