Skip to main content


Command Description

A specified target element may be composed of multiple child elements, and the child elements themselves could also be composed of even more child elements, forming a tree structure. By specifying a child element level, it is possible to get all elements within the certain scope in the form of a one dimensional array, and elements in the array are memory address objects

Command Prototype

arrElement = UiElement.GetChildren(objUiElement,level, optionArgs)

Parameter Description

objUiElementTruedecorator@ui""Specify the root element of the obtained child element
levelTruenumber1The layer of child element is set to be 1 by default, referring to all elements at the first layer under the root node element (child elements). When the layer is set to be 2, all elements at the first (child elements) and second (grandchild elements) layers will be returned. And when the layer is set to be 3, all elements at the first (child elements), second (grandchild elements) and third (great-grandchild elements) layers will be returned. The rest can be done in the same manner. When the layer of child element set here exceeds the actual number of layers, the returned result will be the same as when the layer is set to be 0, meaning elements at all layers
bContinueOnErrorNonebooleanNoneSpecify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value
iDelayAfterNonenumber300Delay time (in milliseconds) after executing the activity is 300 milliseconds
iDelayBeforeNonenumber200The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds


arrElement,The variable used to save the output of the command.


TracePrint "--------------------Get child elements--------------------" 
// --------------------------------------------------------
// [Remarks] Get child elements, this Demo gets the child elements of the entire page of Baidu homepage
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// level--child element level
// Input parameter 3:
// optionArgs--optional parameters (including: error continue execution/delay after execution/delay before execution).Type:Dict

// Output parameters:
// arrElement--The variable to which the output of the function call is saved

// Command Prototype:arrElement = UiElement.GetChildren(objUiElement,level, optionArgs)
// --------------------------------------------------------

arrElement = UiElement.GetChildren(@ui"Block-level element <div>_Baidu homepage settings login news hao123 map post bar video pictures online disk more translations Academic Library Encyclopedia know health",1, {"bContinueOnError":false, "iDelayAfter":300,"iDelayBefore":200})