When To Use Computer Actions
- You need full-screen interaction, not just DOM selectors.
- The page uses canvas or custom rendering where selectors are unreliable.
- You want a robust fallback when Playwright/Puppeteer actions fail.
How It Works
Every session includes acomputerActionEndpoint. The SDKs wrap this for you with client.computerAction.* (Node.js) and client.computer_action.* (Python). You can pass either a session ID or the full session object, and passing the session object is recommended.
Cursor position, current-cursor helpers, and modifier keys require Node SDK 1.1.0+ or Python SDK 1.10.0+.
Coordinates are pixels relative to the top-left of the session screen. The default screen size is 1280x720. If you change
screen in session creation, adjust your coordinates accordingly.Using cURL
You can also send JSON requests directly to thecomputerActionEndpoint returned when you create a session. The full URL already includes its authentication token, so no additional authentication header is needed.
The cURL examples require curl and jq. Save your session creation response as session.json, then set the endpoint once in your shell:
POST to this same URL. JSON action names use snake case, such as press_keys, while fields such as returnScreenshot, numClicks, and scrollY use camel case.
Quickstart
This example navigates using keyboard input, scrolls, and captures a screenshot.Action Examples
The cURL examples useCOMPUTER_ACTION_ENDPOINT set above. Successful actions return JSON with success: true. Add "returnScreenshot": true to an action to include a base64 screenshot in the response; the screenshot action always returns one.
Click, drag, and scroll accept optional keys in xdotool format, such as Control_L or Shift_L. These keys are held during the action and released afterward. Omit keys for an unmodified action.
Cursor Position
Read the pointer’s current position in screen pixels. Like other actions, this returnsComputerActionResponse; check the shared data variant before reading x and y. You can also request a screenshot with returnScreenshot (Node.js/cURL) or return_screenshot (Python).
Click
Click at the Current Cursor
UseclickAtCursor() in Node.js, or omit both x and y from Python’s click(), to click without moving the pointer. Node.js click() still requires coordinates.
Type Text
Press Keys
Uses the xdotool format for keys: https://github.com/sickcodes/xdotool-gui/blob/master/key_list.csvMove Mouse
Drag
Scroll
scroll() moves the pointer to the supplied coordinates before scrolling. Its coordinate arguments remain required in both SDKs.
Scroll at the Current Cursor
UsescrollAtCursor() (Node.js) or scroll_at_cursor() (Python) to scroll without moving the pointer. Both deltas default to zero, so pass a nonzero delta to scroll. You can optionally hold modifier keys, just as with scroll().