open
Theopen 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, network, and actions 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
The URL to open. Passed as the first positional argument.
Run the browser in headed (visible) mode. This is the default when neither flag is passed.
Run the browser in headless mode. Useful for automated runs that don’t need a visible window.
Name for this session. If omitted, Libretto generates a unique name automatically. Use a consistent name to target the session with later commands.
Viewport size in
WIDTHxHEIGHT format, for example 1920x1080. Falls back to the value in .libretto/config.json, then 1366x768.--headed and --headless are mutually exclusive. Passing both raises an error.Examples
connect
Theconnect 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
The CDP endpoint URL to connect to. Passed as the first positional argument. Example:
http://127.0.0.1:9222.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 codesnapshot— capture a screenshot and analyze the pagepages— list open pagesnetwork— view captured network requestsactions— view recorded actions
Examples
exec
Execute Playwright TypeScript against the open page.
snapshot
Capture a screenshot and analyze page state.