Skip to main content

Sandbox

Properties

Methods

doubleClick()

Double left click on the mouse position.
Parameters
Returns
Promise<void>

drag()

Drag the mouse from the given position to the given position.
Parameters
Returns
Promise<void>

getApplicationWindows()

Get the window ID of the window with the given title.
Parameters
Returns
Promise<string[]> The ID of the window.

getCurrentWindowId()

Get the current window ID.
Returns
Promise<string> The ID of the current window.

getCursorPosition()

Get the current cursor position.
Returns
Promise<CursorPosition> A object with the x and y coordinates
Throws
Error if cursor position cannot be determined

getScreenSize()

Get the current screen size.
Returns
Promise<ScreenSize> An ScreenSize object
Throws
Error if screen size cannot be determined

getWindowTitle()

Get the title of the window with the given ID.
Parameters
Returns
Promise<string> The title of the window.

launch()

Launch an application.
Parameters
Returns
Promise<void>

leftClick()

Left click on the mouse position.
Parameters
Returns
Promise<void>

middleClick()

Middle click on the mouse position.
Parameters
Returns
Promise<void>

mousePress()

Press the mouse button.
Parameters
Returns
Promise<void>

mouseRelease()

Release the mouse button.
Parameters
Returns
Promise<void>

moveMouse()

Move the mouse to the given coordinates.
Parameters
Returns
Promise<void>

open()

Open a file or a URL in the default application.
Parameters
Returns
Promise<void>

press()

Press a key.
Parameters
Returns
Promise<void>

rightClick()

Right click on the mouse position.
Parameters
Returns
Promise<void>

screenshot()

screenshot()
Take a screenshot and save it to the given name.
Returns
Promise<Uint8Array<ArrayBufferLike>> A Uint8Array bytes representation of the screenshot.
screenshot(format)
Take a screenshot and save it to the given name.
Parameters
Returns
Promise<Uint8Array<ArrayBufferLike>> A Uint8Array bytes representation of the screenshot.
screenshot(format)
Take a screenshot and save it to the given name.
Parameters
Returns
Promise<Blob> A Blob representation of the screenshot.
screenshot(format)
Take a screenshot and save it to the given name.
Parameters
Returns
Promise<ReadableStream<Uint8Array<ArrayBufferLike>>> A ReadableStream of bytes representation of the screenshot.

scroll()

Scroll the mouse wheel by the given amount.
Parameters
Returns
Promise<void>

wait()

Wait for the given amount of time.
Parameters
Returns
Promise<void>

waitAndVerify()

Wait for a command to return a specific result.
Parameters
Returns
Promise<boolean> true if the command returned the result within the timeout, otherwise false.

write()

Write the given text at the current cursor position.
Parameters
Returns
Promise<void>

create()

create(this, opts)
Create a new sandbox from the default desktop sandbox template.
Type Parameters
Parameters
Returns
Promise<InstanceType<S>> sandbox instance for the new sandbox.
Example
Constructs
Sandbox
create(this, template, opts)
Create a new sandbox from the specified sandbox template.
Type Parameters
Parameters
Returns
Promise<InstanceType<S>> sandbox instance for the new sandbox.
Example
Constructs
Sandbox

Interfaces

SandboxOpts

Configuration options for the Sandbox environment. SandboxOpts

Properties

display?

Display identifier.

dpi?

Dots per inch (DPI) setting for the display.

resolution?

The screen resolution in pixels, specified as [width, height].