Enter-in-Target
Command Description
Input text in the specified interface element
Command Prototype
Keyboard.InputText(objUiElement,sText,bEmptyField,iDelayBetweenKeys,iTimeOut,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objUiElement | True | decorator | @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 |
sText | True | string | "" | Write text into the specified interface element |
bEmptyField | True | boolean | True | Whether to clear the input box before writing the text |
iDelayBetweenKeys | True | number | 20 | The 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 |
iTimeOut | True | number | 10000 | Specify 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) |
bContinueOnError | None | boolean | None | Specify 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 |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 500 | The 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 |
bSetForeground | None | boolean | True | Whether to activate the target window before executing |
sSimulate | None | enum | "message" | You can choose Operation Type as: Background Operation (UIA), Simulation Operation (Simulate), System Message (MersSage), Default Selection: System Message (Message) |
bValidate | None | boolean | None | If the property of "Write Text" and the actual input are the same, continue to run. Otherwise, throw an error |
bClickBeforeInput | None | boolean | None | After finding the target, first click on the target and then enter the content |
Demo
TracePrint "--------------------Enter in target--------------------"
// --------------------------------------------------------
// [Remarks] Enter in the target, the Demo is to enter "UiBot" in the Baidu search bar
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// sText--write text
// 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/operation type/verify written text/click before input).Type:Dict
// Command Prototype:Keyboard.InputText(objUiElement,sText,bEmptyField,iDelayBetweenKeys,iTimeOut,optionArgs)
// --------------------------------------------------------
Keyboard.InputText(@ui"Input Controls<input>","UiBot",true,20,10000,{"bContinueOnError": false, "iDelayAfter": 300, "iDelayBefore": 500, "bSetForeground": true, "sSimulate": "message", "bValidate": false, "bClickBeforeInput": false})