# CLI Reference: camoufox Command-line interface reference for the `camoufox` executable. The `camoufox` CLI communicates with a background daemon over a Unix domain socket using newline-delimited JSON messages. --- ## Global Options The following flags are available across all subcommands: - `--socket `: Path to the daemon Unix socket. - If omitted, defaults to `$XDG_RUNTIME_DIR/camoufox/daemon.sock` when `XDG_RUNTIME_DIR` is set. - Otherwise, defaults to `/tmp/camoufox-/daemon.sock`. - For the default path, the runtime directory must be a real directory owned by the current UID with no group or other permissions (`mode & 0o077 == 0`). Symlinks and non-owner access are rejected. - If an explicit `--socket ` path is passed, this directory policy is skipped and only an existing parent directory is required. - `--json`: Output response as JSON instead of formatted text. - `-h, --help`: Print help. ### JSON Response Envelope When `--json` is supplied, every command outputs a top-level `DaemonResponse` JSON envelope: ```json { "ok": true, "data": { ... } } ``` On daemon or execution errors, the envelope returns: ```json { "ok": false, "error": "error description" } ``` and the process exits with code `1`. Client-side argument validation errors exit with code `2`. Commands that return a void result (such as `stop` and `shutdown`) return `{"ok": true}` with no `data` field. For commands that produce output data, the "JSON output shape" blocks documented below represent the inner payload of this `data` field. --- ## Subcommands Index | Subcommand | Description | |---|---| | [`serve`](#serve) | Start the daemon process | | [`launch`](#launch) | Launch a new browser instance | | [`dialog`](#dialog) | Accept or dismiss an open JavaScript dialog | | [`list`](#list) | List all running browser instances | | [`stop`](#stop) | Stop a browser instance | | [`new-page`](#new-page) | Create a new page in a browser instance | | [`navigate`](#navigate) | Navigate a page to a URL | | [`evaluate`](#evaluate) | Evaluate JavaScript on a page | | [`click`](#click) | Click an element by CSS selector, or at viewport coordinates (x, y) | | [`screenshot`](#screenshot) | Take a screenshot of a page | | [`shutdown`](#shutdown) | Shut down the daemon and all browser instances | | [`ping`](#ping) | Ping the daemon | | [`cookies`](#cookies) | Export all cookies for a browser instance (including HttpOnly) | | [`text`](#text) | Print the page's visible text (`innerText`), optionally scoped to a selector | | [`html`](#html) | Print page HTML: `outerHTML` of a selector, or the whole document | | [`links`](#links) | List every `` on the page as `text → href` | | [`data`](#data) | Extract structured page metadata (Open Graph / JSON-LD / meta tags) | | [`url`](#url) | Print the page's current URL and title | | [`back`](#back) | Go back one entry in the page's session history | | [`forward`](#forward) | Go forward one entry in the page's session history | | [`reload`](#reload) | Reload the page | | [`wait`](#wait) | Poll until an element matching a CSS selector exists | | [`cookie`](#cookie) | Set a cookie for the instance's browser context: `name=value` | | [`header`](#header) | Set an extra HTTP request header for a page: `Name: value` | | [`fill`](#fill) | Focus the element matching a selector, clear it, and type a value into it | | [`type`](#type) | Type text into whatever element currently has focus | | [`press`](#press) | Press a named key (Enter, Tab, Escape, ArrowDown, a, 1, …) | | [`hover`](#hover) | Move the mouse over the element matching a selector (no click) | | [`select`](#select) | Choose an option in a `` by value, label, or visible text. ```text Usage: camoufox select [OPTIONS] ``` - ``: Instance ID. - ``: Page ID. - ``: CSS selector of the `