Skip to main content

Click-Text

Command Description

Search according to the rules, INTERFACE Element contains specified strings and click on this interface element, click the location to find the text position

Command Prototype

Text.Click(objUiElement,sText,iRule,iOccurrence,iButton,iType,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""To find the parent element of the text, the program conducts "find text" within this element. When the property is passed as a string, the child element is looked up as a feature string. When the property is passed as an UiElement, the lookup is directly done in the UiElement. When the property is passed as null, the lookup is done in all windows
sTextTruestring""The text used for finding elements
iRuleTrueenum"instr"The rule used for finding text
iOccurrenceTruenumber1If the string in the Text field appears multiple times in the indicated UI element, specify the number of occurrences to click, for example, if the string appears 4 times and you want to click the first match, please Write 1 in this field
iButtonTrueenum"left"Mouse button {left: Left button, right: Right button, middle: Middle button}
iTypeTrueenum"click"Click type {click: single click, dbclick: double click, down: keydown, up: keyup}
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
iDelayBeforeNonenumber200The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds
bSetForegroundNonebooleanTrueWhether to activate the target window before executing
sCursorPositionNoneenum"Center"Describes the cursor start point for adding offsets for the offsetx and offsety properties. The following options are available: topleft, topright, bottomleft, bottomlight, and center. The default option is center
iCursorOffsetXNonenumberNoneThe horizontal movement of the cursor based on the option in the "Position" field
iCursorOffsetYNonenumberNoneThe vertical offset of the cursor position based on the option selected in the "Position" field
sKeyModifiersNoneset[]Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win
sSimulateNoneenum"simulate"Available operation types are: Background Operation (uia), Simulated Operation (simulate), System Message(message). Default: Simulated Operation (simulate)

Demo

TracePrint("--------------------------Click on the text------------------- --------") 
//-------------------------------------------------------------------------------
//[Remarks] Search for the interface element containing the specified string according to the rules and click the interface element, the click position is the found text position
//Input parameter 1:
// objUiElement--Identifies the target. Note: If you need to find the parent element of the text, the program will search for the text operation in this element. When the attribute is passed as string type, it will search for the interface element as a feature string and then search for child elements. When the attribute is passed as UiElement type , lookup directly in this UiElement element, if passed as null, lookup in all windows
// sText--The text that needs to be found in the target. Note: Text to use when finding elements
// iRule--find rules. Note: Rules to use when looking for text
// iOccurrence--similar result location. Note: If the string in the Text field appears multiple times in the indicated interface element, specify the number of occurrences to click here. For example, if the string appears 4 times and you want to click on the first occurrence, write 1 in this field
// iButton--mouse click. Note: mouse button {left: left button, right: right button, middle: middle button}
// iType--click type. Note: Click type {click: click, dbclick: double click, down: press, up: pop up}
// iTimeOut--timeout time (milliseconds). Note: Specifies the time (in milliseconds) to wait to retry to find screen extents before throwing an error. Default 30000 milliseconds (30 seconds)
// optionArgs--Optional parameters. Note: This parameter is a number of optional parameters, including error continue execution, delay after execution, delay before execution, activation window, cursor position, abscissa offset, ordinate offset, auxiliary keys, operation type
//out parameters:
// None
//
//命令原型:Text.Click(objUiElement,sText,iRule,iOccurrence,iButton,iType,iTimeOut,optionArgs)
Text.Click(@ui"text<span>_click text","dot","instr",1,"left","click",10000,{"bContinueOnError":false,"iDelayAfter":300," iDelayBefore":200,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate"})