Skip to main content

Set-Element-Selection

Command Description

Select elements (list boxes, drop-down lists, etc.)

Command Prototype

UiElement.SetSelect(objUiElement,arrItem,sMode,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""Feature string of elements
arrItemTrueexpression[]Array of elements to be selected (selection mode depends on the sMode property)
sModeTrueenum"text"Selection method: When the parameter is passed as index, select with the index order starting from 0. When the parameter is passed as text, select with the text options. When the parameter is passed as value, select with the value attribute
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

Demo

TracePrint "--------------------Set element selection--------------------" 
// --------------------------------------------------------
// [Remarks] Set the element to be checked, the Demo needs to use IE to open the URL below
// url: http://www.vrbrothers.com/cn/wqm/demo/pages/Demo-ComplexForm.aspx
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// arrItem--contains elements
// Input parameter 3:
// sMode--selection mode
// Input parameter 4:
// optionArgs--optional parameters (including: error continue execution/delay after execution/delay before execution).Type:Dict

// Command prototype: UiElement.SetSelect(objUiElement, arrItem, sMode, optionArgs)
// --------------------------------------------------------

UiElement.SetSelect(@ui"drop-down list<select>_province/city, Anhui, Macau, Beijing, Fujian, Gansu, Guangdong, Guangxi, Guizhou, Hainan, Hebei, Heilongjiang, Hubei, Hunan, Jilin, Jiangsu, Jiang1",["Anhui"],"text",{"bContinueOnError" :false,"iDelayAfter":300,"iDelayBefore":200})