Skip to main content
You are currently viewing documentation for version 1.0.1 of the E2B Desktop SDK (Python). The sandbox module does not exist in the latest version.View the latest version of this reference.

Sandbox

get_video_stream_url

Get the video stream URL.

take_screenshot

Take a screenshot and return it as a stream of bytes.

take_screenshot

Take a screenshot and return it as a bytearray.

take_screenshot

Take a screenshot and return it in the specified format. Arguments:
  • format: The format of the screenshot. Can be ‘bytes’, ‘blob’, or ‘stream’.
Returns: The screenshot in the specified format.

left_click

Left click on the current mouse position.

double_click

Double left click on the current mouse position.

right_click

Right click on the current mouse position.

middle_click

Middle click on the current mouse position.

scroll

Scroll the mouse wheel by the given amount. Arguments:
  • amount: The amount to scroll.

move_mouse

Move the mouse to the given coordinates. Arguments:
  • x: The x coordinate.
  • y: The y coordinate.

get_cursor_position

Get the current cursor position. Returns: A tuple with the x and y coordinates.

get_screen_size

Get the current screen size. Returns: A tuple with the width and height.

write

Write the given text at the current cursor position. Arguments:
  • text: The text to write.

press

Press a key. Arguments:
  • key: The key to press (e.g. “enter”, “space”, “backspace”, etc.).

hotkey

Press a hotkey. Arguments:
  • keys: The keys to press (e.g. hotkey("ctrl", "c") will press Ctrl+C).

open

Open a file or a URL in the default application. Arguments:
  • file_or_url: The file or URL to open.