Window
represents an OS window and provides methods to interact with it,
such as moving, resizing, focusing, and searching for UI elements within it.
class Window implements WindowInterfaceMethods
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 instanceReturns
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 instanceReturns
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 retrieveReturns
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
Returns
Promise<boolean>on
on(searchInput: object, callback: WindowElementCallback): voidregisters a callback which is triggered once a certain searchInput is found
Parameters
searchInputobjectto trigger the callback onresize
resize(newSize: Size): Promise<boolean>resizes the window to a new
Parameters
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 instancetimeoutMs?numberTimeout in milliseconds after which failsupdateInterval?numberUpdate interval in milliseconds to retry searchReturns
Promise<WindowElement>Was this page helpful?