Skip to main content

The-Interface-Elements-Where-the-Searched-Text-Is-Located

Command Description

Follow the Find Text Rules to find Interface Element in the location of the text

Command Prototype

arrElement = Text.FindElement(objUiElement,sText,iRule,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""Interface elements that are selected with the mouse, including windows and elements
sTextTruestring""The text used when looking up
iRuleTrueenum"instr"Rules used when looking up
iTimeOutTruenumber30000Specify the time in milliseconds to wait for a retry to find the text. If exceeded, an error will be thrown. Default: 30,000 milliseconds (30 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
bSetForegroundNonebooleanTrueWhen the target window is an IE browser, you can set whether the window is activated before the operation is executed. Default: yes

return

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

Demo

TracePrint("----------------------------Find the interface element where the text is located------------- -------------") 
//-------------------------------------------------------------------------------
//[Remarks] According to the search text rules, find the interface element where the text is located
//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 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
// iTimeOut--timeout time (milliseconds). Note: Specifies the time (in milliseconds) to wait to retry the find screen extent 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, post-execution delay, pre-execution delay, activation window
//out parameters:
// arrElement--The variable to which the output of the function call is saved.
//
//Command Prototype:arrElement = Text.FindElement(objUiElement,sText,iRule,iTimeOut,optionArgs)
arrElement = Text.FindElement(@ui"Text<span>_Find the interface element where the text is located","Find","instr",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore ":200,"bSetForeground":true})
TracePrint(arrElement)