TeScreen Object
Description
A terminal emulator screen that fully supports HLLAPI.
IMPORTANT
The TeScreen object represents the application area. It changes each time input is received from the host.
By default, OpenText Functional Testing identifies a screen object using its label property. The value of the label property is determined by the location of the label area, which is defined by the values of the label column, label length, and label row properties. These description properties are part of the TeScreen test object description and are therefore not available in the Object Identification dialog box. For more information on the Object Identification dialog box, see the OpenText Functional Testing User Guide.
Operations
The sections below list the built-in methods and properties that you can use as operations for the TeScreen object.
Note: You can also view a list and descriptions of the TeScreen 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. |
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 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 OpenText Functional Testing 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 | Waits until a response is received from the host and the emulator status is set to Ready, or until the timeout is reached, before continuing with the run session. |
ToString | Returns a string that represents the test object. |
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. |
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.
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 test 'results. TeWindow("TeWindow").TEScreen("Sign On").GetCursorPos row, Col If row = 14 And Col = 36 Then TeWindow("TeWindow").TEScreen("Sign On").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 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 '"Flights LOGON" screen. FullText = TeWindow("TeWindow").TEScreen("Flights LOGON").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").TEScreen("Flights LOGON").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. OpenText Functional Testing 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).
Example
'The following example uses the SendKey method to send the ENTER key to the 'emulator screen. TeWindow("TeWindow").TEScreen("Flights LOGON").SendKey TE_ENTER 'or TeWindow("TeWindow").TEScreen("Flights LOGON").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. The row position is 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. The column position is 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.
Example
'The following example uses the SetCursorPos method to place the cursor in the 'last row and last column of the "Flights LOGON" screen. After the cursor is in 'position, the SendKey method is used to press the ENTER key. LastRow = TeWindow("TeWindow").TEScreen("Flights LOGON").RowCount LastCol = TeWindow("TeWindow").TEScreen("Flights LOGON").ColumnCount TeWindow("TeWindow").TEScreen("Flights LOGON").SetCursorPos LastRow, LastCol TeWindow("TeWindow").TEScreen("Flights LOGON").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. This is the 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. This is the 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.
This is the string that is copied to the screen.
|
Return Type
None
IMPORTANT
- 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.
Example
'The following example uses the SetText method to copy the "Bravo" string to 'the current cursor position in the screen. TeWindow("TeWindow").TEScreen("Flights LOGON").GetCursorPos row, Col TeWindow("TeWindow").TEScreen("Flights LOGON").SetText row, Col, "Bravo"
Sync Method
Description
Waits until a response is received from the host and the emulator status is set to Ready, or until the timeout is reached, before continuing with the run session.
Syntax
object.Sync [lMilliseconds]
Arguments
Parameter | Description |
---|---|
lMilliseconds |
Optional. A long integer value. The time, in milliseconds, after which OpenText Functional Testing continues to the next step if the specified value is not achieved. If no value is specified, OpenText Functional Testing uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box.
For more information, refer to the Terminal Emulator Add-in in the Add-ins section of the OpenText Functional Testing Help Center.
Default value = 0 |
Return Type
None
IMPORTANT
A Ready emulator status indicates that the emulator is able to receive user input.
This method uses the Object Synchronization Timeout set in the Run pane of the Test Settings dialog box if no timeout is specified. OpenText Functional Testing automatically inserts a Sync statement each time the emulator waits for a response from the host.
Note: Neither the Active Screen nor the Run Results Viewer displays a screen capture for the Sync step.
Example
'The following example uses the Sync method to wait for the "Flights LOGON" 'screen to synchronize before continuing to the next step. TeWindow("TeWindow").TEScreen("Flights LOGON").SendKey TE_ENTER TeWindow("TeWindow").TEScreen("Flights LOGON").Sync
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, OpenText Functional Testing 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 OpenText Functional Testing continues to the next step if the specified value is not achieved. If no value is specified, OpenText Functional Testing uses the time set in the Object Synchronization Timeout option in the Run pane of the Test Settings dialog box. Default value = 0 |
RegExp |
Optional. A long integer value. If True, OpenText Functional Testing recognizes the String argument as a regular expression. If False, OpenText Functional Testing recognizes this argument as text. For more information about regular expressions, refer to the OpenText Functional Testing User Guide. Default = False Default value = 0 |
Return Type
A Boolean value.
This method returns a value of True if the specified string appears on the screen, or False if the timeout period expires before the string appears.
IMPORTANT
You can optionally define a specified rectangle where the string should appear on the screen. The specified 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 "Flights LOGON" screen or for 10 seconds to 'pass before continuing to the next screen. TeWindow("TeWindow").TEScreen("Flights LOGON").WaitString "User", 5, 1, 5, 4, 10000
'The following example uses the WaitString method to wait 10 seconds for a 'string defined as a regular expression to appear on the third line of the 'screen after sending the ENTER key to the emulator. 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").TEScreen("Login").SendKey TE_ENTER Res = TeWindow("TeWindow").TEScreen("Login").WaitString(".*LAST ACCESS AT \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 places the cursor in the last row and last column of the 'emulator screen. LastRow = TeWindow("TeWindow").TEScreen("Flights LOGON").RowCount LastCol = TeWindow("TeWindow").TEScreen("Flights LOGON").ColumnCount TeWindow("TeWindow").TEScreen("Flights LOGON").SetCursorPos 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 places the cursor in the last row and last column of the 'emulator screen. LastRow = TeWindow("TeWindow").TEScreen("Flights LOGON").RowCount LastCol = TeWindow("TeWindow").TEScreen("Flights LOGON").ColumnCount TeWindow("TeWindow").TEScreen("Flights LOGON").SetCursorPos LastRow, LastCol
See also: