UFT Developer JavaScript SDK Reference


UFT Developer provides test automation capabilities in your IDE for Agile Development, Continuous Integration, Mobile, and DevOps.

Use the UFT Developer JavaScript SDK to write functional tests in JavaScript to test your application. This SDK reference describes all of the objects, classes, and definitions available in the SDK and provides UFT Developer JavaScript SDK code samples.

Note: This reference covers UFT Developer versions 2021 through 23.4. Any version-specific changes are indicated where relevant.

To learn more about using JavaScript in UFT Developer, see Setting up and working with the JavaScript SDK.

Using the LFT Namespace

Start your code with a var <variable name> = require ("leanFT") statement to load the main LeanFT module. In the code samples, we use the variable name LFT. Therefore, we refer to the main namespace as LFT.

Within this namespace, you can use the following functions, namespaces, classes, enumerations, and types:

Functions

FunctionDescription
afterTest

Call this function after each test method.

beforeTest

Call this function before each test method.

cleanup

Performs an SDK cleanup when connection ends.

init

Initializes the SDK with the specified configuration.

Back to top

Namespaces

ClassDescription
AI
Provides the SDK for executing AI-based tests.
APITesting
Provides the SDK for executing API tests.
Insight
Provides the SDK for image-based object identification.
Java
Provides the SDK for testing Java objects.
Mobile
Provides the SDK for testing objects in mobile applications.
Oracle
Provides the SDK for testing Oracle objects.
SAPGUI
Provides the SDK for testing SAPGUI objects.
SAPUI5
Provides the SDK for testing SAPUI5 objects.
StdWin
Provides the SDK for testing standard Windows objects.
TerminalEmulators
Provides the SDK for testing Terminal Emulators objects.

UIAPro (tech preview)

(UFT Developer 2023)

Provides the SDK for testing objects using UI Automation.
Web
Provides the SDK for testing Web objects.
WinForms
Provides the SDK for testing .NET Windows Forms objects.
WPF
Provides the SDK for testing WPF objects.

Back to top

Classes

NamespaceDescription
Desktop
A top-level Window or Dialog test object.
ImageUtils
Provides image utilities, such as OCR, image comparisons, and image find operations.
KeyboardEnables low-level keyboard operations.
MouseEnables low-level mouse operations.
ReporterProvides the means to report custom events, additional data, and configuration for the report.
SDKThe LeanFT SDK base class.

Back to top

Enumerations

EnumDescription
FunctionKeysRepresents the function keys.
KeyModifierRepresents additional pressed keys.
KeysRepresents keyboard keys.
ScrollOrientationRepresents the orientation of the scroll bar.
WindowExtendedStylesRepresents extended window style properties.
WindowStateRepresents the window's current state (maximized/minimized).
WindowStylesRepresents window style properties.

Back to top

Types

TypeDescription
CheckedStateThe state of a check box.
DateFormatTypeIndicates whether a date entity refers to a single date or to one or more date ranges.
GridSelectionModeThe selections that are possible in a grid.
HorizontalThe horizontal location of the related test object relative to the object to identify.
LocationThe location (relative to an object in the application) at which to perform the operation.
MouseButtonThe mouse button to use.
PointThe coordinates of a point on the screen.
PositionIndicates the corners or center of an object.
Proximity The distance or hierarchical location of the related test object relative to the object to identify.
ScrollTypeThe type of scrolling operation.
SwipeDirectionThe direction of the swipe.
Vertical The vertical location of the related test object relative to the object to identify.
VerticalScrollPositionThe position of the Vertical scrollbar.
AutAn abstraction of an AUT process launched by the user.
NativeObject

Represents a native object in an application. Returned by any test object's nativeObject method, enabling you to access the object's native properties and methods.

RectLocationDescribes the location and size of a rectangular area on the screen.

Back to top