Text Property (TextObject Objects)

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use this method to obtain the text displayed on the control or window element associated with the TextObject object.

Declaration

TestObj.Text

Read-Only Property String
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following object:

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Property Value

A string containing the recognized text.

Example

The following example demonstrates how to obtain the text displayed in a control:

JavaScript, JScript

function Test()
{
  var process, window, TextObject;
  // Obtains the process and window of the tested application
  process = Sys.Process("SampleApp");
  window = process.Window("*", "Sample");
  // Obtains the object exposed by the Text Recognition plugin
  TextObject = window.TextObject("SampleText");
  // Posts the text recognized by the Text Recognition subsystem to the test log
  Log.Message(TextObject.Text);

}

Python

def Test():
  # Obtains the process and window of the tested application
  process = Sys.Process("SampleApp")
  window = process.Window("*", "Sample")
  # Obtains the object exposed by the Text Recognition plugin
  TextObject = window.TextObject("SampleText")
  # Posts the text recognized by the Text Recognition subsystem to the test log
  Log.Message(TextObject.Text)

VBScript

Sub Test

  Dim process, window, TextObject
  ' Obtains the process and window of the tested application
  Set process = Sys.Process("SampleApp")
  Set window = process.Window("*", "Sample")
  ' Obtains the object exposed by the Text Recognition plugin
  Set TextObject = window.TextObject("SampleText")
  ' Posts the text recognized by the Text Recognition subsystem to the test log
  Log.Message(TextObject.Text)

End Sub

DelphiScript

procedure Test();
var process, window, TextObject;
begin
  // Obtains the process and window of the tested application
  process := Sys.Process('SampleApp');
  window := process.Window('*', 'Sample');
  // Obtains the object exposed by the Text Recognition plugin
  TextObject := window.TextObject('SampleText');
  // Posts the text recognized by the Text Recognition subsystem to the test log
  Log.Message(TextObject.Text);

end;

C++Script, C#Script

function Test()
{
  var process, window, TextObject;
  // Obtains the process and window of the tested application
  process = Sys["Process"]("SampleApp");
  window = process["Window"]("*", "Sample");
  // Obtains the object exposed by the Text Recognition plugin
  TextObject = window["TextObject"]("SampleText");
  // Posts the text recognized by the Text Recognition subsystem to the test log
  Log["Message"](TextObject["Text"]);

}

See Also

TextObject Object
Using Text Recognition Technology - Overview

Highlight search results