Version:
classimplements WindowInterface

Window

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>

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

Parameters

searchInputobject | Promise<object>A WindowedFindInput instance

Returns

Promise<WindowElement>

findAll

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

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

Parameters

searchInputobject | Promise<object>A WindowedFindInput instance

Returns

Promise<WindowElement[]>

focus

focus(): Promise<boolean>

focus brings the window to the foreground and gives it focus

Returns

Promise<boolean>

getElements

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

getElements retrieves the UI element tree of the window

Parameters

maxElements?numberOptional maximum number of elements to retrieve

Returns

Promise<WindowElement>

getRegion

getRegion(): Promise<Region>

getRegion returns the Region occupied by the window, clamped to screen boundaries

Returns

Promise<Region>

getTitle

getTitle(): Promise<string>

getTitle returns the title of the window

Returns

Promise<string>

minimize

minimize(): Promise<boolean>

minimize minimizes the window

Returns

Promise<boolean>

move

move(newOrigin: Point): Promise<boolean>

move moves the window to a new origin Point

Parameters

newOriginPointThe target Point for the window's new position

Returns

Promise<boolean>

on

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

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

Parameters

searchInputobjectto trigger the callback on
callbackWindowElementCallbackThe FindHookCallback function to trigger

resize

resize(newSize: Size): Promise<boolean>

resize resizes the window to a new Size

Parameters

newSizeSizeThe target Size for the window

Returns

Promise<boolean>

restore

restore(): Promise<boolean>

restore restores a minimized window

Returns

Promise<boolean>

waitFor

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

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

Parameters

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

Returns

Promise<WindowElement>

Was this page helpful?