Sandbox
Properties
Property | Modifier | Type |
---|---|---|
display | readonly | string |
stream | readonly | VNCServer |
Methods
doubleClick()
Returns
Promise
<void
>
drag()
Parameters
Parameter | Type | Description |
---|---|---|
from | [number , number ] | The starting position. |
to | [number , number ] | The ending position. |
Returns
Promise
<void
>
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 determinedleftClick()
Returns
Promise
<void
>
middleClick()
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()
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 | "up" | "down" | '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
>
create()
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.