TeTextScreen Object
Description
A terminal emulator screen that uses text-only HLLAPI or does not support HLLAPI.
IMPORTANT
UFT One uses this object to identify elements in the terminal emulator screen as text on a specific location in the screen. It does not recognize fields.
Note: The recorded and smart description properties of the TeTextScreen object cannot be configured. This object is therefore not included in the Test Object classes list for the Terminal Emulators environment in the Object Identification dialog box. For details on the Object Identification dialog box, see the UFT One User Guide.
Operations
The sections below list the built-in methods and properties that you can use as operations for the TeTextScreen object.
Note: You can also view a list and descriptions of the TeTextScreen description properties, for use in object repository descriptions, programmatic descriptions, checkpoint and output value steps, and as argument values for the GetTOProperty and GetROProperty methods.
Methods
CaptureBitmap | Saves a screen capture of the object as a .png or .bmp image using the specified file name. |
Check | Checks whether the actual value of an item matches the expected value. |
CheckProperty | Checks whether the actual value of the specified object property matches the specified expected value within the specified timeout. |
ChildObjects | Returns the collection of child objects contained within the object. |
GetAllROProperties | Returns the collection of properties and current values from the object in the application. |
Click | Clicks on a set of coordinates on the emulator screen. |
ClickPosition | Clicks the specified row and column position on the emulator screen. |
GetCursorPos | Returns the position of the cursor in the emulator screen. |
GetROProperty | Returns the current value of the description property from the object in the application. |
GetText | Returns the text from the specified emulator screen rectangle. |
GetTOProperties | Returns the collection of properties and values used to identify the object. |
GetTOProperty | Returns the value of the specified description property from the test object description. |
Highlight | Highlights the object in the application. |
Output | Retrieves the current value of an item and stores it in a specified location. |
RefreshObject | Instructs UFT One to re-identify the object in the application the next time a step refers to this object. |
SendKey | Sends a keystroke or string of keystrokes to the current cursor position in the emulator screen. |
SetCursorPos | Changes the position of the cursor within the emulator screen. |
SetText | Copies a string to a specific location in the emulator screen. |
SetTOProperty | Sets the value of the specified description property in the test object description. |
Sync | For tests, this method uses the Object Synchronization Timeout setting in the Run pane of the Test Settings dialog box if a value is not specified for the timeout. For components, this method uses the default Object Synchronization Timeout setting if a value is not specified for the timeout. Note: Neither the Active Screen nor the Run Results Viewer displays a screen capture for the Sync step. |
ToString | Returns a string that represents the test object. |
Type | Types the specified string at the current location of the cursor. |
WaitProperty | Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step. |
WaitString | Waits for a specified string to appear on the emulator screen before continuing the run session. |
Properties
ColumnCount | Returns the total number of columns in the emulator screen. |
Exist | Checks whether the object currently exists in the open application. |
RowCount | Returns the total number of rows (lines) on the emulator screen. |
Click Method
Description
Clicks on a set of coordinates on the emulator screen.
Syntax
object.Click [X], [Y], [BUTTON]
Arguments
Parameter | Description |
---|---|
X |
Optional. An integer value. The x-coordinate of the click. Default value = -9999 |
Y |
Optional. An integer value. The y-coordinate of the click. Default value = -9999 |
BUTTON |
Optional. A predefined constant or number.
Indicates the mouse button to click.
Default value = micLeftBtn |
Return Type
None
IMPORTANT
If no coordinates are specified, the default click will be at the center of the emulator text screen.
Note: This method is not recorded. To add this method to your test or component, use the Step Generator or enter it in the Keyword View or Editor. For more information on the Step Generator, the Keyword View, and the Editor, refer to the UFT One User Guide. When you click a location on your emulator text screen while recording, the ClickPosition method is recorded. For more information, see ClickPosition.
Example
'The following example uses the Click method to click a right mouse 'button at coordinates 47, 131 on the terminal emulator text screen. TeTextScreen("TeTextScreen").Click 47, 131, 1
ClickPosition Method
Description
Clicks the specified row and column position on the emulator screen.
Syntax
object.ClickPosition Row, Column
Arguments
Parameter | Description |
---|---|
Row |
Required. A long integer value. The row position where the click is performed. The first row in the screen is 1. |
Column |
Required. A long integer value. The column position where the click is performed. The first column in the screen is 1. |
Return Type
None
IMPORTANT
While recording, UFT One records a ClickPosition statement whenever a click is performed, even if the cursor position does not change in the emulator screen. This has no impact on your run session.
Notes:
You can modify the Terminal Emulator Add-in configuration settings to prevent UFT One from recording ClickPosition statements.
In addition, if the coordinates recorded in the ClickPosition statements are not as you would expect, you can use the Terminal Emulator Configuration Wizard to adjust the UFT One screen calculation algorithm.
For more information, see the Terminal Emulator Add-in in the Add-ins section of the UFT One Help Center.
Example
'The following example uses the ClickPosition method to click in row 5, 'column 4 of the terminal emulator screen. TeWindow("TeWindow").TeTextScreen("TeTextScreen").ClickPosition 5, 4
GetCursorPos Method
Description
Returns the position of the cursor in the emulator screen.
Syntax
object.GetCursorPos ScreenRow, ScreenCol
Arguments
Parameter | Description |
---|---|
ScreenRow |
Required. A Variant. The retrieved row position of the cursor in the emulator screen. The first row in the screen is 1. |
ScreenCol |
Required. A Variant. The retrieved column position of the cursor in the emulator screen. The first column in the screen is 1. |
Return Type
None
IMPORTANT
Typically, you use this function to ensure the cursor is at the correct location in the screen before sending data using the SendKey method. For more information, see SendKey.
Note: Use the GetCursorPos method only if your terminal emulator settings have been configured to fully support HLLAPI. If your emulator does not support the HLLAPI QueryCursorLocation function no. 7, you may receive unexpected results.
Example
'The following example uses the GetCursorPos method to verify that the 'cursor is located at row 14, column 36. If the position is correct, the 'ENTER key is sent to the emulator screen. Otherwise an error message is 'inserted in the run results. TeWindow("TeWindow").TeTextScreen("TeTextScreen").GetCursorPos row, Col If row = 14 And Col = 36 Then TeWindow("TeWindow").TeTextScreen("TeTextScreen").SendKey TE_ENTER Else Reporter.ReportEvent 1, "Wrong Cursor Position", "Row = " & row & ",Col = " & Col End If
GetText Method
Description
Returns the text from the specified emulator screen rectangle.
Syntax
object.GetText ([TopRow], [LeftCol], [BottomRow], [RightCol])
Arguments
Parameter | Description |
---|---|
TopRow |
Optional. A long integer value. The top coordinate of the rectangle. The first row in the screen is 1. Default = 1 Default value = 0 |
LeftCol |
Optional. A long integer value. The left coordinate of the rectangle. The first column in the screen is 1. Default = 1 Default value = 0 |
BottomRow |
Optional. A long integer value. The bottom coordinate of the rectangle. Default = last row number Default value = 0 |
RightCol |
Optional. A long integer value. The right coordinate of the rectangle. Default = last column number Default value = 0 |
Return Type
A String value.
IMPORTANT
The rectangle is defined by pairs of coordinates that designate two diagonally opposite corners of the rectangle. To get the total number of rows and columns on the screen, use the RowCount and ColumnCount methods.
Example
'The following example uses the GetText method to retrieve all the text from 'the emulator screen. FullText = TeWindow("TeWindow").TeTextScreen("TeTextScreen").GetText()
'The following example uses the GetText method to retrieve the text from the 'specified screen rectangle created from the coordinates at row 4, column 7 'and row 19, column 75. ScrText = TeWindow("TeWindow").TeTextScreen("TeTextScreen").GetText(4, 7, 19, 75)
SendKey Method
Description
Sends a keystroke or string of keystrokes to the current cursor position in the emulator screen.
Syntax
object.SendKey Key
Arguments
Parameter | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Key |
Required. A String value. UFT One sends the string of keystrokes to the host presentation space. The string can contain up to 255 characters. More than one character may be required to represent a keystroke. Some key strokes can also be represented using predefined keyboard mnemonics listed in the table below. Note: Not all terminal emulators support all keyboard mnemonics. For more information, see your emulator documentation.
|
Return Type
None
IMPORTANT
- You can send data keys (for example, A, B, C) or attention identifier keys (for example, TE_ENTER or TE_PA1).
Note: Use the SendKey method only if your terminal emulator settings have been configured to fully support HLLAPI. If your emulator does not support the HLLAPI SendKey function no. 1, you may get unexpected results.
- This method is not supported for Micro Focus Reflection Desktop for UNIX or OpenVMS.
Example
'The following example uses the SendKey method to send the ENTER key to the 'emulator screen. TeWindow("TeWindow").TeTextScreen("TeTextScreen").SendKey TE_ENTER 'or TeWindow("TeWindow").TeTextScreen("TeTextScreen").SendKey "@E"
SetCursorPos Method
Description
Changes the position of the cursor within the emulator screen.
Syntax
object.SetCursorPos ScreenRow, ScreenCol
Arguments
Parameter | Description |
---|---|
ScreenRow |
Required. A long integer value. Row position where the cursor is placed in the emulator screen. The first row in the screen is 1. To get the total number of rows in the screen, use the RowCount method. |
ScreenCol |
Required. A long integer value. Column position where the cursor is placed in the emulator screen. The first column in the screen is 1. To get the total number of columns in the screen, use the ColumnCount method. |
Return Type
None
IMPORTANT
- Typically you use this method to place the cursor in the appropriate position before sending data using the SendKey method.
Note: Use the SetCursorPos method only if your terminal emulator settings have been configured to fully support HLLAPI. If your emulator does not support the HLLAPI SetCursor function no. 40, you may get unexpected results.
- This method is not supported for Micro Focus Reflection Desktop for UNIX or OpenVMS.
Example
'The following example uses the SetCursorPos method to place the cursor in 'the last row and last column of the emulator screen. After the cursor is in 'position, the SendKey method is used to press the ENTER key. LastRow = TeWindow("TeWindow").TeTextScreen("TeTextScreen").RowCount LastCol = TeWindow("TeWindow").TeTextScreen("TeTextScreen").ColumnCount TeWindow("TeWindow").TeTextScreen("TeTextScreen").SetCursorPos LastRow, LastCol TeWindow("TeWindow").TeTextScreen("TeTextScreen").SendKey TE_ENTER
SetText Method
Description
Copies a string to a specific location in the emulator screen.
Syntax
object.SetText ScreenRow, ScreenCol, Text
Arguments
Parameter | Description |
---|---|
ScreenRow |
Required. A long integer value. Row position in the screen where you want to place the string. The first row in the screen is 1. To get the total number of rows in the screen, use the RowCount method. |
ScreenCol |
Required. A long integer value. Column position in the screen where you want to place the string. The first column in the screen is 1. To get the total number of columns in the screen, use the ColumnCount method. |
Text |
Required. A String value. The string that is copied to the screen. |
Return Type
None
IMPORTANT
- Use the SetText method only if your terminal emulator settings have been configured to fully support HLLAPI. If your emulator does not support the HLLAPI CopyStringtoPresentationSpace function no. 15, you may get unexpected results.
- If the data string being copied extends beyond the end of the field to which it is being copied in a field-formatted presentation space, data will be truncated.
- The string size cannot exceed the screen size.
- The SetText method can be used to enter only printable characters, not keystrokes such as TE_ENTER. After using this method to copy printable characters to the emulator screen, you can use the SendKey method to send TE_ENTER or another special key to the host.
- This method does not change the location of the cursor.
- You can use the GetCursorPos method to determine the position of the cursor in the emulator screen. You can then use that value as the position for the SetText method.
- This method is not supported for Micro Focus Reflection Desktop for UNIX or OpenVMS.
Example
'The following example uses the SetText method to copy the Bravo string to 'the current cursor position in the screen. TeWindow("TeWindow").TeTextScreen("TeTextScreen").GetCursorPos row, Col TeWindow("TeWindow").TeTextScreen("TeTextScreen").SetText row, Col, "Bravo"
Sync Method
Description
For tests, this method uses the Object Synchronization Timeout setting in the Run pane of the Test Settings dialog box if a value is not specified for the timeout.
For components, this method uses the default Object Synchronization Timeout setting if a value is not specified for the timeout.
Note: Neither the Active Screen nor the Run Results Viewer displays a screen capture for the Sync step.
Syntax
object.Sync [lMilliseconds]
Arguments
Parameter | Description |
---|---|
lMilliseconds |
Optional. A long integer value. The time, in milliseconds, after which UFT One continues to the next step if the specified value is not achieved. If no value is specified, UFT One uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box. Default value = 0 |
Return Type
None
Example
'The following example uses the Sync method to wait 10 seconds before 'continuing to the next step. TeWindow("TeWindow").TeTextScreen("TeTextScreen").Sync 10000
Type Method
Description
Types the specified string at the current location of the cursor.
Syntax
object.Type wsTypeSeq
Arguments
Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wsTypeSeq |
Required. A String value. The text string and/or constants representing non-alphanumeric keys. The following constants are available:
|
Return Type
None
IMPORTANT
Tip: If you want to type the string into a specific location on the emulator screen, use the TeTextScreen.ClickPosition statement to move the cursor to the correct field before using the Type method. For more information, see ClickPosition.Example
'The following example uses the Type method to type "guys" and press ENTER 'into the field which is in the 4th row, 5th column of the screen. TeWindow("TeWindow").TeTextScreen("TeTextScreen").ClickPosition 4, 5 TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type "guys" + micReturn
WaitString Method
Description
Waits for a specified string to appear on the emulator screen before continuing the run session.
Syntax
object.WaitString (Text, [TopRow], [LeftCol], [BottomRow], [RightCol], [Milliseconds], [RegExp])
Arguments
Parameter | Description |
---|---|
Text |
Required. A String value. The text string that must appear on the screen. If the value of the RegExp argument is True, UFT One recognizes the string as a regular expression. |
TopRow |
Optional. A long integer value. The top coordinate of the rectangle. The first row in the screen is 1. Default = 1 Default value = 0 |
LeftCol |
Optional. A long integer value. The left coordinate of the rectangle. The first column in the screen is 1. Default = 1 Default value = 0 |
BottomRow |
Optional. A long integer value. The bottom coordinate of the rectangle. Default = last row number Default value = 0 |
RightCol |
Optional. A long integer value. The right coordinate of the rectangle. Default = last column number Default value = 0 |
Milliseconds |
Optional. A long integer value. The time, in milliseconds, after which UFT One continues to the next step if the specified value is not achieved. For tests, if no value is specified, UFT One uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box. For components, if no value is specified, UFT One uses the default Object Synchronization Timeout setting. Default value = 0 |
RegExp |
Optional. A long integer value. If True, UFT One recognizes the Text argument as a regular expression. If False, UFT One recognizes this argument as text. For more information about regular expressions, refer to the UFT One User Guide. Default = False Default value = 0 |
Return Type
A Boolean value.
IMPORTANT
You can optionally define a specified rectangle where the string should appear on the screen. The string can be a constant string or a regular expression.
Example
'The following example uses the WaitString method to wait for the word "User" 'to appear in a specific rectangle on the screen or for 10 seconds to pass 'before continuing to the next screen. TeWindow("TeWindow").TeTextScreen("TeTextScreen").WaitString "User", 5, 1, 5, 4, 10000
'The following example uses the WaitString method to send the ENTER key to 'the emulator and waits 10 seconds for a string defined as a regular 'expression to appear on the third line of the screen. If a string appears 'that matches the regular expression, for example, CH70001 LAST ACCESS AT '14:27:07 ON THURSDAY, the test continues. Otherwise, an error message is 'inserted in the run results. TeWindow("TeWindow").TeTextScreen("Login").SendKey TE_ENTER Res = TeWindow("TeWindow").TeTextScreen("Login").WaitString(".*LAST ACCESSAT \d\d:\d\d:\d\d ON .*DAY.*", 3, 1, 3, 80, 10000, True) If Res = False Then Reporter.ReportEvent micFail, "Login screen", "Expected string not found" End If
ColumnCount Property
Description
Returns the total number of columns in the emulator screen.
Syntax
object.ColumnCount
Value Type
A long integer value.
Property type
Read-only property
Example
'The following example uses the ColumnCount method to calculate the total 'number of columns and then clicks in the last row and last column of the 'emulator screen. LastRow = TeWindow("TeWindow").TeTextScreen("TeTextScreen").RowCount LastCol = TeWindow("TeWindow").TeTextScreen("TeTextScreen").ColumnCount TeWindow("TeWindow").TeTextScreen("TeTextScreen").ClickPosition LastRow, LastCol
RowCount Property
Description
Returns the total number of rows (lines) on the emulator screen.
Syntax
object.RowCount
Value Type
A long integer value.
Property type
Read-only property
Example
'The following example uses the RowCount method to calculate the total number 'of rows and then clicks in the last row and last column of the emulator 'screen. LastRow = TeWindow("TeWindow").TeTextScreen("TeTextScreen").RowCount LastCol = TeWindow("TeWindow").TeTextScreen("TeTextScreen").ColumnCount TeWindow("TeWindow").TeTextScreen("TeTextScreen").ClickPosition LastRow, LastCol
See also: