Version:
classimplements WindowInterface

Window

represents an OS window and provides methods to interact with it,
such as moving, resizing, focusing, and searching for UI elements within it.

typescript
class Window implements WindowInterface

Methods

find

find(searchInput: object | Promise<object>): Promise<WindowElement>

will search for a single occurrence of a given search input in the current window.

Parameters

searchInputobject | Promise<object>A instance

Returns

Promise<WindowElement>

findAll

findAll(searchInput: object | Promise<object>): Promise<WindowElement[]>

will search for multiple occurrence of a given search input in the current window.

Parameters

searchInputobject | Promise<object>A instance

Returns

Promise<WindowElement[]>

focus

focus(): Promise<boolean>

brings the window to the foreground and gives it focus

Returns

Promise<boolean>

getElements

getElements(maxElements?: number): Promise<WindowElement>

retrieves the UI element tree of the window

Parameters

maxElements?numberOptional maximum number of elements to retrieve

Returns

Promise<WindowElement>

getRegion

getRegion(): Promise<Region>

returns the occupied by the window, clamped to screen boundaries

Returns

Promise<Region>

getTitle

getTitle(): Promise<string>

returns the title of the window

Returns

Promise<string>

minimize

minimize(): Promise<boolean>

minimizes the window

Returns

Promise<boolean>

move

move(newOrigin: Point): Promise<boolean>

moves the window to a new origin

Parameters

newOriginPointThe target for the window's new position

Returns

Promise<boolean>

on

on(searchInput: object, callback: WindowElementCallback): void

registers a callback which is triggered once a certain searchInput is found

Parameters

searchInputobjectto trigger the callback on
callbackWindowElementCallbackThe function to trigger

resize

resize(newSize: Size): Promise<boolean>

resizes the window to a new

Parameters

newSizeSizeThe target for the window

Returns

Promise<boolean>

restore

restore(): Promise<boolean>

restores a minimized window

Returns

Promise<boolean>

waitFor

waitFor(searchInput: object | Promise<object>, timeoutMs?: number, updateInterval?: number, params?: OptionalSearchParameters<PROVIDER_DATA_TYPE>): Promise<WindowElement>

repeatedly searches for a query to appear in the window until it is found or the timeout is reached

Parameters

searchInputobject | Promise<object>A instance
timeoutMs?numberTimeout in milliseconds after which fails
updateInterval?numberUpdate interval in milliseconds to retry search
params?OptionalSearchParameters<PROVIDER_DATA_TYPE>which are used to fine tune search

Returns

Promise<WindowElement>

Was this page helpful?