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.
class Window implements WindowInterfaceMethods
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 instanceReturns
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 instanceReturns
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 retrieveReturns
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
Returns
Promise<boolean>on
on(searchInput: object, callback: WindowElementCallback): voidon registers a callback which is triggered once a certain searchInput is found
Parameters
searchInputobjectto trigger the callback onresize
resize(newSize: Size): Promise<boolean>resize resizes the window to a new Size
Parameters
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 instancetimeoutMs?numberTimeout in milliseconds after which waitFor failsupdateInterval?numberUpdate interval in milliseconds to retry searchparams?OptionalSearchParameters<PROVIDER_DATA_TYPE>OptionalSearchParameters which are used to fine tune searchReturns
Promise<WindowElement>Was this page helpful?