Skip to main content

Using commands

POST /browser/commands runs navigation, waits, clicks, and extraction in a single request. Send a JSON array of commands; Browsr keeps them in the same session and returns the results in order.

If you omit session_id, the server creates one and returns it in the response. Reuse that ID for future calls to keep cookies, viewport, and navigation history alive.

Command payload shape

  • session_id (optional): reuse an existing session.
  • headless (optional): run Chrome without UI.
  • commands: ordered list of objects with command and data.

Example: navigate, wait, and extract Markdown

 # Omit session_id to auto-create

curl -X POST "http://localhost:8082/browser/commands" \
-H "Content-Type: application/json" \
-d '{
"session_id": "session-123",
"headless": true,
"commands": [
{ "command": "navigate_to", "data": { "url": "https://example.com" } },
{ "command": "wait_for_element", "data": { "selector": "main", "timeout_ms": 5000 } },
{ "command": "get_content", "data": { "selector": "main", "kind": "markdown" } }
]
}'

Each object in commands runs sequentially. Responses return the result for every step so you can inspect output or cache the payload for deterministic replays.

Common commands

[
{ "command": "navigate_to", "data": { "url": "https://example.com" } },
{ "command": "wait_for_element", "data": { "selector": "main", "timeout_ms": 5000 } },
{ "command": "click", "data": { "selector": "a.cta" } },
{ "command": "type", "data": { "selector": "#search", "text": "browsr" } },
{ "command": "get_content", "data": { "selector": "main", "kind": "markdown" } }
]

Use the agent with overlays and bounding boxes while designing the payload, then replay the same JSON headlessly to eliminate extra LLM calls.