To learn more about using JavaScript in LeanFT, see Setting up and working with the JavaScript SDK.
For JavaScript code samples, see Code Samples - JavaScript.

TextScreenTO

TerminalEmulators. TextScreenTO

ScreenTO

Constructor

new TextScreenTO()

A terminal emulator screen that uses text-only HLLAPI or does not support HLLAPI.

Methods

click(argsopt) → {Promise.<void>}

Clicks on this object using the definitions from the supplied args object. If you do not provide the args object, the click is performed in the center of the object using the left mouse button.
Parameters:
Name Type Attributes Description
args Object <optional>
The arguments for the click operation.
Properties
Name Type Attributes Default Description
button MouseButton <optional>
MouseButton.left The mouse button to use for the click.
anchor Position <optional>
Position.center The position within the object from which the offset is taken.
offset Object <optional>
The offset from the anchor position.
Properties
Name Type Attributes Default Description
x Number <optional>
0 The x-coordinate of the offset.
y Number <optional>
0 The y-coordinate of the offset.
Returns:
a promise that is fulfilled when the click operation ends.
Type
Promise.<void>

clickPosition(position) → {Promise.<void>}

Clicks the specified row and column position on the emulator screen.
Parameters:
Name Type Description
position Object If a Position object is passed, it will click on the position within the emulator screen.
Properties
Name Type Attributes Description
row Number <optional>
The row position of the cursor in the emulator screen.
column Number <optional>
The column position of the cursor in the emulator screen.
Returns:
a promise that is fulfilled when the clickPosition operation ends.
Type
Promise.<void>

getText(areaopt) → {Promise.<String>}

Returns the text from the specified screen rectangle.
Parameters:
Name Type Attributes Description
area Object <optional>
If an Area object is passed, it will return the string from that location.
Properties
Name Type Attributes Description
top Number <optional>
Top position of the rectangle.
left Number <optional>
Left position of the rectangle.
bottom Number <optional>
Bottom position of the rectangle.
right Number <optional>
Right position of the rectangle.
Returns:
a promise that is fulfilled with the contents of the specified text.
Type
Promise.<String>

sendKeys(inputopt, modifiersopt) → {Promise.<void>}

Sends keyboard keys to an object.
Parameters:
Name Type Attributes Default Description
input string <optional>
The string to send to the object. Use FunctionKeys and Keys for special keys.
modifiers KeyModifier <optional>
KeyModifier.none The modifier keys. Use KeyModifier for this parameter.
Returns:
a promise that is fulfilled when the sendKeys operation ends.
Type
Promise.<void>

size() → {Promise.<Object>}

The terminal emulator screen column count and row count.
Returns:
a promise that is fulfilled with the object's size.
Type
Promise.<Object>

sync(millisecondsopt) → {Promise.<void>}

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.
Parameters:
Name Type Attributes Description
milliseconds Number <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled when the sync operation ends.
Type
Promise.<void>

waitForText(text, millisecondsopt) → {Promise.<Bool>}

Waits for specific text to appear on the emulator screen before continuing the run session.

Example 1:
Use the waitForText method to wait 10 seconds for the string "CH70001 LAST ACCESS AT 14:27:07 ON THURSDAY", where this string is defined as a regular expression:
waitForText(new RegExp(".*LAST ACCESS AT \d\d:\d\d:\d\d ON .*DAY.*"), 10000)

Example 2:
Use the waitForText method to wait 5 seconds for the string "User":
waitForText("User", 5000)
Parameters:
Name Type Attributes Description
text String | RegExp The specified string or regular expression for which the emulator screen is waiting.
milliseconds Number <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled with the state of the specified inputs.
Type
Promise.<Bool>

waitForTextInArea(text, area, millisecondsopt) → {Promise.<Bool>}

Waits for specific text to appear on the emulator screen before continuing the run session.

Example 1:
Use the waitForText method to wait 10 seconds for the string, "CH70001 LAST ACCESS AT 14:27:07 ON THURSDAY", where this string is defined as a regular expression:
waitForText(new RegExp(".*LAST ACCESS AT \d\d:\d\d:\d\d ON .*DAY.*"), {top: 6, left: 53, bottom: 6, right: 60}, 10000)

Example 2:
Use the waitForText method to wait 5 seconds for the string User":
waitForText("User", {top: 6, left: 53, bottom: 6, right: 60}, 5000)
Parameters:
Name Type Attributes Description
text String | RegExp The specified string or regular expression for which the emulator screen is waiting.
area Object If an Area object is passed, it will wait for text from that location.
If a number is passed, it will wait this number of milliseconds for a response..
Properties
Name Type Description
top Number Top position of the rectangle.
left Number Left position of the rectangle.
bottom Number Bottom position of the rectangle.
right Number Right position of the rectangle.
milliseconds Number <optional>
If a number is passed, it will wait this number of milliseconds for a response.
Returns:
a promise that is fulfilled with the state of the specified inputs.
Type
Promise.<Bool>