Sandbox
Properties
| Property | Modifier | Type | Default value |
|---|---|---|---|
display | public | string | ':0' |
stream | public | VNCServer | undefined |
Methods
doubleClick()
Parameters
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns
Promise<void>
drag()
Parameters
| Parameter | Type | Description |
|---|---|---|
from | [number, number] | The starting position. |
to | [number, number] | The ending position. |
Returns
Promise<void>
getApplicationWindows()
Parameters
| Parameter | Type |
|---|---|
application | string |
Returns
Promise<string[]>
The ID of the window.
getCurrentWindowId()
Returns
Promise<string>
The ID of the current window.
getCursorPosition()
Returns
Promise<CursorPosition>
A object with the x and y coordinates
Throws
Error if cursor position cannot be determinedgetScreenSize()
Returns
Promise<ScreenSize>
An ScreenSize object
Throws
Error if screen size cannot be determinedgetWindowTitle()
Parameters
| Parameter | Type | Description |
|---|---|---|
windowId | string | The ID of the window. |
Returns
Promise<string>
The title of the window.
launch()
Parameters
| Parameter | Type | Description |
|---|---|---|
application | string | The application to launch. |
uri? | string | The URI to open in the application. |
Returns
Promise<void>
leftClick()
Parameters
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns
Promise<void>
middleClick()
Parameters
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns
Promise<void>
mousePress()
Parameters
| Parameter | Type | Default value |
|---|---|---|
button | "left" | "right" | "middle" | 'left' |
Returns
Promise<void>
mouseRelease()
Parameters
| Parameter | Type | Default value |
|---|---|---|
button | "left" | "right" | "middle" | 'left' |
Returns
Promise<void>
moveMouse()
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | The x coordinate. |
y | number | The y coordinate. |
Returns
Promise<void>
open()
Parameters
| Parameter | Type | Description |
|---|---|---|
fileOrUrl | string | The file or URL to open. |
Returns
Promise<void>
press()
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | string[] | The key to press (e.g. “enter”, “space”, “backspace”, etc.). Can be a single key or an array of keys. |
Returns
Promise<void>
rightClick()
Parameters
| Parameter | Type |
|---|---|
x? | number |
y? | number |
Returns
Promise<void>
screenshot()
screenshot()
Returns
Promise<Uint8Array<ArrayBufferLike>>
A Uint8Array bytes representation of the screenshot.
screenshot(format)
Parameters
| Parameter | Type | Description |
|---|---|---|
format | "bytes" | The format of the screenshot. |
Returns
Promise<Uint8Array<ArrayBufferLike>>
A Uint8Array bytes representation of the screenshot.
screenshot(format)
Parameters
| Parameter | Type |
|---|---|
format | "blob" |
Returns
Promise<Blob>
A Blob representation of the screenshot.
screenshot(format)
Parameters
| Parameter | Type |
|---|---|
format | "stream" |
Returns
Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>
A ReadableStream of bytes representation of the screenshot.
scroll()
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
direction | "down" | "up" | 'down' | The direction to scroll. Can be “up” or “down”. |
amount | number | 1 | The amount to scroll. |
Returns
Promise<void>
wait()
Parameters
| Parameter | Type | Description |
|---|---|---|
ms | number | The amount of time to wait in milliseconds. |
Returns
Promise<void>
waitAndVerify()
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
cmd | string | undefined | The command to run. |
onResult | (result: CommandResult) => boolean | undefined | The function to check the result of the command. |
timeout | number | 10 | The maximum time to wait for the command to return the result. |
interval | number | 0.5 | The interval to wait between checks. |
Returns
Promise<boolean>
true if the command returned the result within the timeout, otherwise false.
write()
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | The text to write. |
options | object | An object containing the chunk size and delay between each chunk of text. |
options.chunkSize | number | The size of each chunk of text to write. Default is 25 characters. |
options.delayInMs | number | The delay between each chunk of text. Default is 75 ms. |
Returns
Promise<void>
betaCreate()
betaCreate(this, opts)
desktop sandbox template.
Type Parameters
| Type Parameter |
|---|
S extends typeof Sandbox |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | S | - |
opts? | SandboxBetaCreateOpts | connection options. |
Returns
Promise<InstanceType<S>>
sandbox instance for the new sandbox.
Example
Constructs
SandboxbetaCreate(this, template, opts)
Type Parameters
| Type Parameter |
|---|
S extends typeof Sandbox |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | S | - |
template | string | sandbox template name or ID. |
opts? | SandboxBetaCreateOpts | connection options. |
Returns
Promise<InstanceType<S>>
sandbox instance for the new sandbox.
Example
Constructs
Sandboxcreate()
create(this, opts)
desktop sandbox template.
Type Parameters
| Type Parameter |
|---|
S extends typeof Sandbox |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | S | - |
opts? | SandboxOpts | connection options. |
Returns
Promise<InstanceType<S>>
sandbox instance for the new sandbox.
Example
Constructs
Sandboxcreate(this, template, opts)
Type Parameters
| Type Parameter |
|---|
S extends typeof Sandbox |
Parameters
| Parameter | Type | Description |
|---|---|---|
this | S | - |
template | string | sandbox template name or ID. |
opts? | SandboxOpts | connection options. |
Returns
Promise<InstanceType<S>>
sandbox instance for the new sandbox.