Skip to content
Dashboard

Execute single action

client.computers.execute(stringid, ComputerExecuteParams { action } body, RequestOptionsoptions?): ActionResult { error_message, executed_tab_id, page_context, 4 more }
POST/computers/{id}/execute

Execute a single action such as screenshot, click, type, navigate, scroll, debug, set_viewport, get_html_content or other computer use actions

ParametersExpand Collapse
id: string
body: ComputerExecuteParams { action }
action?: ComputerAction { auto_detect_encoding, base64, button, 22 more }
auto_detect_encoding?: boolean

For get_html_content

base64?: boolean

For screenshot

button?: string
debug?: Debug { command, cwd, env, 4 more }
command?: string
cwd?: string
env?: Record<string, string>
max_output_length?: number
request_id?: string
stream?: boolean
timeout_seconds?: number
dx?: number

For scrolling

dy?: number
height?: number
include_context?: boolean

Include page context in response

key?: string

For key_down/key_up

keys?: Array<string>
ms?: number
proxy_url?: string
request_id?: string

RequestId is used for correlating streaming output to the originating request. Set on ActionRequest, not individual action types.

scale_factor?: number
tab_id?: string

For tab management (browser sessions only)

text?: string
type?: string

click|double_click|right_click|drag|type|keypress|scroll|wait|screenshot|go_to_url|debug|get_html_content|set_viewport|list_tabs|new_tab|switch_tab|close_tab|key_down|key_up|mouse_down|mouse_up

url?: string
width?: number

For set_viewport

x?: number
x1?: number

For dragging/scrolling

x2?: number

For dragging

y?: number
y1?: number
y2?: number
ReturnsExpand Collapse
ActionResult { error_message, executed_tab_id, page_context, 4 more }
error_message?: string
executed_tab_id?: string
page_context?: V2GoBackendInternalTypesPageContext { device_scale_factor, is_main_tab, page_height, 8 more }
device_scale_factor?: number
is_main_tab?: boolean
page_height?: number
page_width?: number
scroll_x?: number
scroll_y?: number
tab_id?: string
title?: string
url?: string
viewport_height?: number
viewport_width?: number
request_id?: string
result?: Record<string, unknown>
status?: string
timestamp?: string

Execute single action

import Lightcone from '@tzafon/lightcone';

const client = new Lightcone({
  apiKey: process.env['TZAFON_API_KEY'], // This is the default and can be omitted
});

const actionResult = await client.computers.execute('id');

console.log(actionResult.executed_tab_id);
{
  "error_message": "error_message",
  "executed_tab_id": "executed_tab_id",
  "page_context": {
    "device_scale_factor": 0,
    "is_main_tab": true,
    "page_height": 0,
    "page_width": 0,
    "scroll_x": 0,
    "scroll_y": 0,
    "tab_id": "tab_id",
    "title": "title",
    "url": "url",
    "viewport_height": 0,
    "viewport_width": 0
  },
  "request_id": "request_id",
  "result": {
    "foo": "bar"
  },
  "status": "status",
  "timestamp": "timestamp"
}
Returns Examples
{
  "error_message": "error_message",
  "executed_tab_id": "executed_tab_id",
  "page_context": {
    "device_scale_factor": 0,
    "is_main_tab": true,
    "page_height": 0,
    "page_width": 0,
    "scroll_x": 0,
    "scroll_y": 0,
    "tab_id": "tab_id",
    "title": "title",
    "url": "url",
    "viewport_height": 0,
    "viewport_width": 0
  },
  "request_id": "request_id",
  "result": {
    "foo": "bar"
  },
  "status": "status",
  "timestamp": "timestamp"
}