Object Model Reference for GUI Testing > Terminal Emulators > GetCursorPos Method

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, UFT 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 Unified 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

Common Method CaptureBitmap Saves a screen capture of the object as a .png or .bmp image using the specified file name.
Common Method Check Checks whether the actual value of an item matches the expected value.
Common Method CheckProperty Checks whether the actual value of the specified object property matches the specified expected value within the specified timeout.
Common Method ChildObjects Returns the collection of child objects contained within the object.
Method GetCursorPos Returns the position of the cursor in the emulator screen.
Common Method GetROProperty Returns the current value of the description properties from the object in the application.
Method GetText Returns the text from the specified screen rectangle.
Common Method GetTOProperties Returns the collection of properties and values used to identify the object.
Common Method GetTOProperty Returns the value of the specified description properties from the test object description.
Common Method Output Retrieves the current value of an item and stores it in a specified location.
Common Method RefreshObject Instructs UFT to re-identify the object in the application the next time a step refers to this object.
Method SendKey Sends a keystroke or string of keystrokes to the current cursor position in the emulator screen.
Method SetCursorPos Changes the position of the cursor within the emulator screen.
Method SetText Copies a string to a specific location in the emulator screen.
Common Method SetTOProperty Sets the value of the specified description properties in the test object description.
Method 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.
Common Method ToString Returns a string that represents the test object.
Common Method WaitProperty Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.
Method WaitString Waits for a specified string to appear on the emulator screen before continuing the run session.

Properties

Property ColumnCount Returns the total number of columns in the emulator screen.
Common Property Exist Checks whether the object currently exists in the open application.
Property RowCount Returns the total number of rows (lines) on the emulator screen.

 

Back to top

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


 

Back to top

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


 

Back to top

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 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.


Key
Mnemonic
Script Constant
@
@@
-
PA1
@x
TE_PA1
PA2
@y
TE_PA2
PA3
@z
TE_PA3
PA4
@+
TE_PA4
PA5
@%
TE_PA5
PA6
@&
TE_PA6
PA7
@'
TE_PA7
PA8
@(
TE_PA8
PA9
@)
TE_PA9
PA10
@*
TE_PA10
PF1
@1
TE_PF1
PF2
@2
TE_PF2
PF3
@3
TE_PF3
PF4
@4
TE_PF4
PF5
@5
TE_PF5
PF6
@6
TE_PF6
PF7
@7
TE_PF7
PF8
@8
TE_PF8
PF9
@9
TE_PF9
PF10
@a
TE_PF10
PF11
@b
TE_PF11
PF12
@c
TE_PF12
PF13
@d
TE_PF13
PF14
@e
TE_PF14
PF15
@f
TE_PF15
PF16
@g
TE_PF16
PF17
@h
TE_PF17
PF18
@i
TE_PF18
PF19
@j
TE_PF19
PF20
@k
TE_PF20
PF21
@l
TE_PF21
PF22
@m
TE_PF22
PF23
@n
TE_PF23
PF24
@o
TE_PF24
Alternate Cursor
@$
TE_ALTERNATE_CURSOR
Attention
@A@Q
TE_ATTENTION
Backspace
@<
TE_BACKSPACE
Backtab
@B
TE_BACKTAB
Clear
@C
TE_CLEAR
Cursor Down
@V
TE_DOWN
Cursor Left
@L
TE_LEFT
Cursor Right
@Z
TE_RIGHT
Cursor Select
@A@J
TE_CURSOR_SELECT
Cursor Up
@U
TE_UP
Delete Character
@D
TE_DELETE
Dup
@S@x
TE_DUP
Enter
@E
TE_ENTER
Erase EOF
@F
TE_ERASE_EOF
Erase Input
@A@F
TE_ERASE_INPUT
Field Exit
@A@E
TE_FIELD_EXIT
Field Mark
@S@y
TE_FIELD_MARK
Field Minus
@A@-
TE_FIELD_MINUS
Field Plus
@A@+
TE_FIELD_PLUS
Home
@0
TE_HOME
End
@q
TE_END
Insert Character
@I
TE_INSERT
New Line
@N
TE_NEW_LINE
Print Screen
@P
TE_LOCAL_PRINT
Page Down
@v
TE_PAGE_DOWN
Page Up
@u
TE_PAGE_UP
Reset
@R
TE_RESET
System Request
@A@H
TE_SYS_REQ
Tab
@T
TE_TAB
Help
@H
TE_HELP
¢ (cent)
@A@c
TE_TEST
| (solid vertical bar)
@A@v
-
Backward Word
@A@z
-
Card Reader
@W
-
Cursor Left Double
@A@L
-
Cursor Right Double
@A@Z
-
Device Cancel
@A@R
-
Magnetic Slot Reader
@Y
-
Forward Word
@A@y
-

Return Type

None

IMPORTANT

You can send data keys (for example, A, B, C, etc.) or attention identifier keys (for example, TE_ENTER or TE_PA1).

Example


 

Back to top

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


 

Back to top

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

Example


 

Back to top

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 UFT continues to the next step if the specified value is not achieved. If no value is specified, UFT 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 Unified Functional Testing Terminal Emulator Add-in User's Guide.

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. UFT 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


 

Back to top

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 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 continues to the next step if the specified value is not achieved. If no value is specified, UFT 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, UFT recognizes the String argument as a regular expression. If False, UFT recognizes this argument as text. For more information about regular expressions, refer to the Unified 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


 

Back to top

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


 

Back to top

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


Back to top

See also: