Skip to main content
Launch a browser session or attach to an existing Chrome DevTools Protocol endpoint.

open

The open command launches a browser and navigates to a URL, creating a new named session. It is the starting point for any interactive workflow: once a session is open, exec, snapshot, and pages all work against it.

When to use open

  • At the start of script authoring when you need live page state to decide how the workflow should work.
  • When the user needs to log in manually before automation begins (use --headed).
  • Any time you need a fresh, isolated browser instance on a specific URL.

Flags

url
string
required
The URL to open. Passed as the first positional argument.
--headed
boolean
Run the browser in headed (visible) mode. This is the default when neither flag is passed.
--headless
boolean
Run the browser in headless mode. Useful for automated runs that don’t need a visible window.
--session
string
Name for this session. If omitted, Libretto generates a unique name automatically. Use a consistent name to target the session with later commands.
--viewport
string
Viewport size in WIDTHxHEIGHT format, for example 1920x1080. Falls back to the value in .libretto/config.json, then 1366x768.
--provider, -p
string
Browser provider to use. One of local, kernel, browserbase, steel, or libretto-cloud. Defaults to local.Resolution order: --provider flag → LIBRETTO_PROVIDER env var → provider field in .libretto/config.json"local".
If a saved auth profile exists for the URL’s domain, open automatically loads it, injecting the saved cookies and localStorage into the new session before navigating. You can override this by passing --auth-profile explicitly, or skip profile loading by not having a saved profile for that domain.

Examples


Cloud browser providers

By default, open launches a local Chromium instance. You can instead run the browser in the cloud using the --provider flag (or LIBRETTO_PROVIDER env var, or provider in .libretto/config.json).

Available providers

Configuration

You can set the provider in three ways (highest precedence first):
  1. CLI flag: --provider kernel (or -p kernel)
  2. Environment variable: LIBRETTO_PROVIDER=kernel
  3. Config file: add "provider": "kernel" to .libretto/config.json
If none is set, the default is local.

Examples

Cloud providers ignore --headed / --headless and --viewport flags since the browser runs remotely. The session is always headless from the local machine’s perspective.

connect

The connect command attaches to an existing Chrome DevTools Protocol (CDP) endpoint rather than launching a new browser. Use it to drive a browser that is already running, for example one started with --remote-debugging-port, an Electron application, or any other CDP-compatible target.

When to use connect

  • You have an existing browser process you want to automate without restarting it.
  • You are driving an Electron app exposed over CDP.
  • You want to attach to a remote browser in a CI environment that has already navigated to the right state.

Flags

cdp-url
string
required
The CDP endpoint URL to connect to. This can be either an HTTP or WebSocket URL and is passed as the first positional argument. Example: http://127.0.0.1:9222.
--session
string
Name for this session. Recommended to set explicitly when using connect so you can reference it later.

After connecting

Once connected, all session-scoped commands work normally against the attached browser:
  • exec: run Playwright TypeScript code
  • snapshot: capture a screenshot and compact accessibility tree
  • pages: list open pages
Libretto does not manage the lifecycle of a connected process. Running npx libretto close --session <name> clears the Libretto session record but does not terminate the remote browser or Electron app.

Examples

exec

Execute Playwright TypeScript against the open page.

snapshot

Capture a screenshot and compact accessibility tree.