Skip to main content

Input-Password-in-the-Target

Command Description

Enter Password in the specified Interface element

Command Prototype

Keyboard.InputPwd(objUiElement,sPwd,bEmptyField,iDelayBetweenKeys,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""When the attribute is transferred as a string, it is used as the characteristic string to find the interface element. When the attribute is transferred as UiElement, directly click on the corresponding interface element
sPwdTruestring""Write text into the specified interface element
bEmptyFieldTruebooleanTrueWhether to clear the input box before writing the text
iDelayBetweenKeysTruenumber20The interval between two input(only effective when Simulation operation is chosen in the attribute of operation type); If the interval is less than 20 milliseconds, it will be automatically converted to 20 milliseconds. If the interval is too short, it might lead to the word loss during the input. It is also affected by the machine performance
iTimeOutTruenumber10000Specify the amount of time (in milliseconds) that wait for the event to run before selectorNotFoundException to trigger an error (in milliseconds) The default value is 10,000 ms (10 seconds)
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
iDelayBeforeNonenumber500The delay time (in milliseconds in milliseconds) before the event is executed, and the amount of time is 500 milliseconds, too short may lead to leak input
bSetForegroundNonebooleanTrueWhether to activate the target window before executing
sSimulateNoneenum"message"You can choose Operation Type as: Background Operation (UIA), Simulation Operation (Simulate), System Message (MersSage), Default Selection: System Message (Message)
bClickBeforeInputNonebooleanNoneAfter finding the target, first click on the target and then enter the content

Demo

TracePrint "--------------------Enter password in target--------------------" 
// --------------------------------------------------------
// [Note] Enter the password in the target, this Demo is to enter the password in the password box of the Taobao login page
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// sPwd--password
// Input parameter 3:
// bEmptyField--clear the original content
// Input parameter 4:
// iDelayBetweenKeys--type interval (ms)
// Input parameter 5:
// iTimeOut--timeout time. Default unit: milliseconds. Type: Int
// Input parameter 6:
// optionArgs--Optional parameters (including: error continue execution/delay after execution/delay before execution/activation window/auxiliary button/operation type/click before input).Type:Dict

// Command Prototype:Keyboard.InputPwd(objUiElement,sPwd,bEmptyField,iDelayBetweenKeys,iTimeOut,optionArgs)
// --------------------------------------------------------

Keyboard.InputPwd(@ui"Input Controls<input>2","gicCYW79cWCCaM5irWDnsQ==",true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})