Description
Use this method to obtain a scripting interface to a child object of the WindowObj window or control. This child object is identified by its text and is exposed by the Text Recognition plugin.
Declaration
TestObj.TextObject(Text, Index)
TestObj | A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section | |||
Text | [in] | Required | String | |
Index | [in] | Optional | Integer | Default value: 1 |
Result | A TextObject object |
Applies To
The method is applied to the following object:
View Mode
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
Parameters
The method has the following parameters:
Text
The object’s text that is recognized by the Text Recognition subsystem and used to identify the object. Wildcards (* and ?) can be used in this parameter.
Index
Index of the object relative to other objects that have the same text. TestComplete generates indexes for objects corresponding to window elements that contain the same text. The leftmost element has an index of 1. The elements that have the same horizontal position are indexed from top to bottom.
To determine the index of the desired window element, explore the application windows and controls in the TestComplete Object Browser.
Result Value
The TextObject
method returns the TextObject
object that provides a scripting interface to a window or control element recognized by its text.
To determine whether the method returns a valid object, use the Exists
property of the resultant object. If this property returns False, then the returned object is a stub object and the call to TextObject
was not successful.
Remarks
When calling this method in TestComplete scripts you can skip the method name (TextObject
) and only specify the text displayed on the desired element of the window.
However, it can be useful if there are no elements of the window with the same text displayed on them and you do not need to specify the index of the object to get access the desired element (otherwise, the object with index 1 will be returned).
Note: | The TextObject method is available only if the Text Recognition plugin is installed and enabled. Otherwise, the method is absent in the method list of the Window object. |
Example
To view an example that demonstrates how to use the TextObject
method, see Using Text Recognition Technology - Overview.
See Also
Object Browser Naming Notation
Onscreen Object
About Open Applications
Requirements
Using Microsoft UI Automation Technology - Overview