Stealth Browser CLI with SKILLS
This package provides CLI interface into Playwright. If you are using coding agents, that is the best fit.
-
CLI: Modern coding agents increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands. This makes CLI + SKILLs better suited for high-throughput coding agents that must balance browser automation with large codebases, tests, and reasoning within limited context windows.
-
MCP: MCP remains relevant for specialized agentic loops that benefit from persistent state, rich introspection, and iterative reasoning over page structure, such as exploratory automation, self-healing tests, or long-running autonomous workflows where maintaining continuous browser context outweighs token cost concerns. Learn more about Playwright MCP.
- Token-efficient. Does not force page data into LLM.
- Node.js 20 or newer
- Claude Code, GitHub Copilot, or any other coding agent.
npm install -g stealth-web-cli
stealth-web-cli --helpClaude Code, GitHub Copilot and others will use the locally installed skills.
stealth-web-cli install --skillsPoint your agent at the CLI and let it cook. It'll read the skill off stealth-web-cli --help on its own:
Test the "add todo" flow on https://demo.playwright.dev/todomvc using stealth-web-cli.
Check stealth-web-cli --help for available commands.
> Use playwright skills to test https://demo.playwright.dev/todomvc/.
Take screenshots for all successful and failing scenarios.
Your agent will be running commands, but it does not mean you can't play with it manually:
stealth-web-cli open https://demo.playwright.dev/todomvc/ --headed
stealth-web-cli type "Buy groceries"
stealth-web-cli press Enter
stealth-web-cli type "Water flowers"
stealth-web-cli press Enter
stealth-web-cli check e21
stealth-web-cli check e35
stealth-web-cli screenshot
Stealth Browser CLI is headless by default. If you'd like to see the browser, pass --headed to open:
stealth-web-cli open https://playwright.dev --headedStealth Browser CLI keeps the browser profile in memory by default. Your cookies and storage state
are preserved between CLI calls within the session, but lost when the browser closes. Use
--persistent to save the profile to disk for persistence across browser restarts.
You can use different instances of the browser for different projects with sessions. Pass -s= to
the invocation to talk to a specific browser.
stealth-web-cli open https://playwright.dev
stealth-web-cli -s=example open https://example.com --persistent
stealth-web-cli listFor login-walled sites, keep a named persistent session so cookies survive browser restarts. After finishing a manual login in headed mode, save a portable storage-state backup as well:
stealth-web-cli -s=social open https://example.com/login --headed --persistent
# complete the login in the browser window, then:
stealth-web-cli -s=social state-save auth.json
# later, reuse the persistent session or restore the backup with state-load auth.jsonYou can run your coding agent with the PLAYWRIGHT_CLI_SESSION environment variable:
PLAYWRIGHT_CLI_SESSION=todo-app claude .Or instruct it to prepend -s= to the calls.
Manage your sessions as follows:
stealth-web-cli list # list all sessions
stealth-web-cli close-all # close all browsers
stealth-web-cli kill-all # forcefully kill all browser processesUse stealth-web-cli show to open a visual dashboard that lets you see and control all running
browser sessions. This is useful when your coding agents are running browser automation in the
background and you want to observe their progress or step in to help.
stealth-web-cli show
The dashboard opens a window with two views:
- Session grid — shows all active sessions grouped by workspace, each with a live screencast preview, session name, current URL, and page title. Click any session to zoom in.
- Session detail — shows a live view of the selected session with a tab bar, navigation controls (back, forward, reload, address bar), and full remote control. Click into the viewport to take over mouse and keyboard input; press Escape to release.
From the grid you can also close running sessions or delete data for inactive ones.
stealth-web-cli open [url] # open browser, optionally navigate to url
stealth-web-cli goto <url> # navigate to a url
stealth-web-cli goto <url> --timeout=5 # navigate with an explicit timeout in seconds
stealth-web-cli close # close the page
stealth-web-cli type <text> # type text into editable element
stealth-web-cli click <ref> [button] # perform click on a web page
stealth-web-cli dblclick <ref> [button] # perform double click on a web page
stealth-web-cli fill <ref> <text> # fill text into editable element
stealth-web-cli fill <ref> <text> --submit # fill and press Enter
stealth-web-cli drag <startRef> <endRef> # perform drag and drop between two elements
stealth-web-cli drop <ref> --path=<file> # drop files onto an element (from outside the page)
stealth-web-cli drop <ref> --data="k=v" # drop data onto an element
stealth-web-cli hover <ref> # hover over element on page
stealth-web-cli select <ref> <val> # select an option in a dropdown
stealth-web-cli upload <file> # upload one or multiple files
stealth-web-cli check <ref> # check a checkbox or radio button
stealth-web-cli uncheck <ref> # uncheck a checkbox or radio button
stealth-web-cli snapshot # capture page snapshot to obtain element ref
stealth-web-cli snapshot --filename=f # save snapshot to specific file
stealth-web-cli snapshot --inline # return snapshot content directly
stealth-web-cli snapshot <ref> # snapshot a specific element
stealth-web-cli snapshot --depth=N # limit snapshot depth for efficiency
stealth-web-cli eval <func> [ref] # evaluate javascript expression on page or element
stealth-web-cli eval <func> --output=f # save the raw evaluation value to an absolute file path
stealth-web-cli dialog-accept [prompt] # accept a dialog
stealth-web-cli dialog-dismiss # dismiss a dialog
stealth-web-cli resize <w> <h> # resize the browser windowstealth-web-cli go-back # go back to the previous page
stealth-web-cli go-forward # go forward to the next page
stealth-web-cli reload # reload the current pagestealth-web-cli press <key> # press a key on the keyboard, `a`, `arrowleft`
stealth-web-cli keydown <key> # press a key down on the keyboard
stealth-web-cli keyup <key> # press a key up on the keyboardstealth-web-cli mousemove <x> <y> # move mouse to a given position
stealth-web-cli mousedown [button] # press mouse down
stealth-web-cli mouseup [button] # press mouse up
stealth-web-cli mousewheel <dx> <dy> # scroll mouse wheelstealth-web-cli screenshot [ref] # screenshot of the current page or element
stealth-web-cli screenshot --filename=f # save screenshot with specific filename
stealth-web-cli pdf # save page as pdf
stealth-web-cli pdf --filename=page.pdf # save pdf with specific filenamestealth-web-cli tab-list # list all tabs
stealth-web-cli tab-new [url] # create a new tab
stealth-web-cli tab-close [index] # close a browser tab
stealth-web-cli tab-select <index> # select a browser tabstealth-web-cli state-save [filename] # save storage state
stealth-web-cli state-load <filename> # load storage state
# Cookies
stealth-web-cli cookie-list [--domain] # list cookies
stealth-web-cli cookie-get <name> # get a cookie
stealth-web-cli cookie-set <name> <val> # set a cookie
stealth-web-cli cookie-delete <name> # delete a cookie
stealth-web-cli cookie-clear # clear all cookies
# LocalStorage
stealth-web-cli localstorage-list # list localStorage entries
stealth-web-cli localstorage-get <key> # get localStorage value
stealth-web-cli localstorage-set <k> <v> # set localStorage value
stealth-web-cli localstorage-delete <k> # delete localStorage entry
stealth-web-cli localstorage-clear # clear all localStorage
# SessionStorage
stealth-web-cli sessionstorage-list # list sessionStorage entries
stealth-web-cli sessionstorage-get <k> # get sessionStorage value
stealth-web-cli sessionstorage-set <k> <v> # set sessionStorage value
stealth-web-cli sessionstorage-delete <k> # delete sessionStorage entry
stealth-web-cli sessionstorage-clear # clear all sessionStoragestealth-web-cli route <pattern> [opts] # mock network requests
stealth-web-cli route-list # list active routes
stealth-web-cli unroute [pattern] # remove route(s)stealth-web-cli console [min-level] # list console messages
stealth-web-cli requests # list all network requests since loading the page
stealth-web-cli request <index> # show details for a specific request
stealth-web-cli run-code <code> # run playwright code snippet
stealth-web-cli run-code --filename=f # run playwright code from a file
stealth-web-cli tracing-start # start trace recording
stealth-web-cli tracing-stop # stop trace recording
stealth-web-cli video-start [filename] # start video recording
stealth-web-cli video-chapter <title> # add a chapter marker to the video
stealth-web-cli video-show-actions # annotate each action with a callout in the video
stealth-web-cli video-hide-actions # stop annotating actions in the video
stealth-web-cli video-stop # stop video recording
stealth-web-cli show # open the visual dashboard
stealth-web-cli show --annotate # launch dashboard for UI review / design feedback
stealth-web-cli generate-locator <ref> # generate a playwright locator for an element
stealth-web-cli highlight <ref> # show a persistent highlight overlay
stealth-web-cli highlight <ref> --style= # highlight with a custom CSS style
stealth-web-cli highlight <ref> --hide # hide highlight on a specific element
stealth-web-cli highlight --hide # hide all page highlightsstealth-web-cli open --browser=chrome # use specific browser
stealth-web-cli attach --extension=chrome # connect via Playwright Extension
stealth-web-cli attach --cdp=chrome # attach to running Chrome/Edge by channel
stealth-web-cli attach --cdp=<url> # attach via CDP endpoint
stealth-web-cli detach # detach an attached session, leaves the external browser running
stealth-web-cli open --persistent # use persistent profile
stealth-web-cli open --profile=<path> # use custom profile directory
stealth-web-cli open --config=file.json # use config file
stealth-web-cli close # close the browser
stealth-web-cli delete-data # delete user data for default sessionBy default, this fork opens new sessions with CloakBrowser only. Patchright and Camoufox are opt-in:
select one with PLAYWRIGHT_CLI_BROWSER_PROVIDER=patchright or camoufox, or configure an explicit
fallback order such as cloakbrowser,patchright,camoufox. Explicit invocation-level
--browser, --config, and PLAYWRIGHT_MCP_CONFIG settings are respected and skip the automatic
provider selection. Ambient upstream environment variables such as PLAYWRIGHT_MCP_BROWSER do not
skip stealth selection: they are frequently set system-wide for other tools and would otherwise
silently launch a stock headless Chromium whose user agent leaks HeadlessChrome (issue #28).
Every open reports the selected provider and installed provider version. Fallback warnings include
the underlying activation or daemon-launch error. Opening an already-running session restarts it and
re-evaluates the configured provider order; list reports the provider name instead of the generic
browser channel. When a session's provider sidecar is missing, the name is recovered only when the
session file still carries identifiable stealth markers (CloakBrowser's --fingerprint argument,
Camoufox's binary path, or the patchright stealth context options); otherwise the generic channel
is reported. Camoufox's browser
binary is installed only when Camoufox is explicitly selected; a fresh selection waits for that
download to finish and uses Playwright's Firefox transport while the other providers retain
Patchright. Patchright's Chrome for Testing browser can be installed explicitly with
stealth-web-cli install-browser chrome-for-testing. An explicit
PLAYWRIGHT_CLI_BROWSER_PROVIDER takes precedence over conflicting upstream browser environment
variables.
Pass --json to any command for a deterministic response. Page commands return ok, url, title,
result, console, and provider. provider contains the active provider and version for managed
sessions and is null when provider selection was bypassed. Failures use the same schema, include an
error, and exit nonzero. When provider selection falls back, responses also contain a persisted
fallback object with requested, active, and the underlying reason, so later commands retain
the same provenance.
{
"provider": { "name": "patchright", "version": "1.61.1" },
"fallback": {
"requested": "cloakbrowser",
"active": "patchright",
"reason": "cloakbrowser: executable not found"
}
}stealth-web-cli goto https://example.com --timeout=5 --json
stealth-web-cli eval '() => document.title' --jsonUse eval --output=<file> when the result is too large for terminal output. String results are written
literally, with real newlines and no JSON quoting; objects and other JSON values retain readable JSON.
The result link contains the absolute output path. Upstream-compatible --filename=<file> remains
available when a JSON-serialized file is desired.
After each command, stealth-web-cli provides a snapshot of the current browser state.
> stealth-web-cli goto https://example.com
### Page
- Page URL: https://example.com/
- Page Title: Example Domain
### Snapshot
[Snapshot](.playwright-cli/page-2026-02-14T19-22-42-679Z.yml)You can also take a snapshot on demand using stealth-web-cli snapshot command. All the options below can be combined as needed.
# default - save to a file with timestamp-based name
stealth-web-cli snapshot
# save to file, use when snapshot is a part of the workflow result
stealth-web-cli snapshot --filename=after-click.yaml
# return snapshot content inline (especially useful with --json)
stealth-web-cli snapshot --inline --json
# snapshot an element instead of the whole page
stealth-web-cli snapshot "#main"
# limit snapshot depth for efficiency, take a partial snapshot afterwards
stealth-web-cli snapshot --depth=4
stealth-web-cli snapshot e34
# include each element's bounding box as [box=x,y,width,height]
stealth-web-cli snapshot --boxesBy default, use refs from the snapshot to interact with page elements.
# get snapshot with refs
stealth-web-cli snapshot
# interact using a ref
stealth-web-cli click e15You can also use css selectors or Playwright locators.
# css selector
stealth-web-cli click "#main > button.submit"
# role locator
stealth-web-cli click "getByRole('button', { name: 'Submit' })"
# test id
stealth-web-cli click "getByTestId('submit-button')"stealth-web-cli -s=name <cmd> # run command in named session
stealth-web-cli -s=name close # stop a named browser
stealth-web-cli -s=name delete-data # delete user data for named browser
stealth-web-cli list # list all sessions
stealth-web-cli close-all # close all browsers
stealth-web-cli kill-all # forcefully kill all browser processesIf global stealth-web-cli command is not available, try a local version via npx stealth-web-cli:
npx --no-install stealth-web-cli --versionWhen local version is available, use npx stealth-web-cli in all commands. Otherwise, install stealth-web-cli as a global command:
npm install -g stealth-web-cliThe Stealth Browser CLI can be configured using a JSON configuration file. You can specify the configuration file using the --config command line option:
stealth-web-cli --config path/to/config.json open example.comStealth Browser CLI will load config from .playwright/cli.config.json by default so that you did not need to specify it every time.
Configuration file schema
{
/**
* The browser to use.
*/
browser?: {
/**
* The type of browser to use.
*/
browserName?: 'chromium' | 'firefox' | 'webkit';
/**
* Keep the browser profile in memory, do not save it to disk.
*/
isolated?: boolean;
/**
* Path to a user data directory for browser profile persistence.
* Temporary directory is created by default.
*/
userDataDir?: string;
/**
* Launch options passed to
* @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
*
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
*/
launchOptions?: playwright.LaunchOptions;
/**
* Context options for the browser context.
*
* This is useful for settings options like `viewport`.
*/
contextOptions?: playwright.BrowserContextOptions;
/**
* Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
*/
cdpEndpoint?: string;
/**
* CDP headers to send with the connect request.
*/
cdpHeaders?: Record<string, string>;
/**
* Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
*/
cdpTimeout?: number;
/**
* Remote endpoint to connect to an existing Playwright server.
*/
remoteEndpoint?: string;
/**
* Paths to TypeScript files to add as initialization scripts for Playwright page.
*/
initPage?: string[];
/**
* Paths to JavaScript files to add as initialization scripts.
* The scripts will be evaluated in every page before any of the page's scripts.
*/
initScript?: string[];
},
/**
* If specified, saves the Playwright video of the session into the output directory.
*/
saveVideo?: {
width: number;
height: number;
};
/**
* The directory to save output files.
*/
outputDir?: string;
/**
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
*/
outputMode?: 'file' | 'stdout';
console?: {
/**
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
*/
level?: 'error' | 'warning' | 'info' | 'debug';
},
network?: {
/**
* List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*/
allowedOrigins?: string[];
/**
* List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*/
blockedOrigins?: string[];
};
/**
* Specify the attribute to use for test ids, defaults to "data-testid".
*/
testIdAttribute?: string;
timeouts?: {
/*
* Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
*/
action?: number;
/*
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
*/
navigation?: number;
};
/**
* Whether to allow file uploads from anywhere on the file system.
* By default (false), file uploads are restricted to paths within the MCP roots only.
*/
allowUnrestrictedFileAccess?: boolean;
/**
* Specify the language to use for code generation.
*/
codegen?: 'typescript' | 'none';
}Configuration via env
| Environment |
|---|
PLAYWRIGHT_MCP_ALLOWED_HOSTS comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check. |
PLAYWRIGHT_MCP_ALLOWED_ORIGINS semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all. Important: does not serve as a security boundary and does not affect redirects. |
PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS allow access to files outside of the workspace roots. Also allows unrestricted access to file:// URLs. By default access to file system is restricted to workspace root directories (or cwd if no roots are configured) only, and navigation to file:// URLs is blocked. |
PLAYWRIGHT_MCP_BLOCKED_ORIGINS semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed. Important: does not serve as a security boundary and does not affect redirects. |
PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS block service workers |
PLAYWRIGHT_MCP_BROWSER browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge. |
PLAYWRIGHT_MCP_CAPS comma-separated list of additional capabilities to enable, possible values: vision, pdf. |
PLAYWRIGHT_MCP_CDP_ENDPOINT CDP endpoint to connect to. |
PLAYWRIGHT_MCP_CDP_HEADERS CDP headers to send with the connect request, multiple can be specified. |
PLAYWRIGHT_MCP_CDP_TIMEOUT timeout for the CDP connection. |
PLAYWRIGHT_MCP_CONFIG path to the configuration file. |
PLAYWRIGHT_MCP_CONSOLE_LEVEL level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels. |
PLAYWRIGHT_MCP_DEVICE device to emulate, for example: "iPhone 15" |
PLAYWRIGHT_MCP_EXECUTABLE_PATH path to the browser executable. |
PLAYWRIGHT_MCP_EXTENSION Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright MCP Bridge" browser extension to be installed. |
PLAYWRIGHT_MCP_GRANT_PERMISSIONS List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write". |
PLAYWRIGHT_MCP_HEADLESS whether to run browser in headless mode, headless by default. |
PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS ignore https errors |
PLAYWRIGHT_MCP_INIT_PAGE path to TypeScript file to evaluate on Playwright page object |
PLAYWRIGHT_MCP_INIT_SCRIPT path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times. |
PLAYWRIGHT_MCP_ISOLATED keep the browser profile in memory, do not save it to disk. |
PLAYWRIGHT_MCP_SANDBOX whether to enable the browser sandbox. |
PLAYWRIGHT_MCP_OUTPUT_DIR path to the directory for output files. |
PLAYWRIGHT_MCP_PROXY_BYPASS comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com" |
PLAYWRIGHT_MCP_PROXY_SERVER specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080" |
PLAYWRIGHT_MCP_SAVE_TRACE Whether to save the Playwright Trace of the session into the output directory. |
PLAYWRIGHT_MCP_SAVE_VIDEO Whether to save the video of the session into the output directory. For example "--save-video=800x600" |
PLAYWRIGHT_MCP_SECRETS_FILE path to a file containing secrets in the dotenv format |
PLAYWRIGHT_MCP_STORAGE_STATE path to the storage state file for isolated sessions. |
PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE specify the attribute to use for test ids, defaults to "data-testid" |
PLAYWRIGHT_MCP_TIMEOUT_ACTION specify action timeout in milliseconds, defaults to 5000ms |
PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION specify navigation timeout in milliseconds, defaults to 60000ms |
PLAYWRIGHT_MCP_USER_AGENT specify user agent string |
PLAYWRIGHT_MCP_USER_DATA_DIR path to the user data directory. If not specified, a temporary directory will be created. |
PLAYWRIGHT_MCP_VIEWPORT_SIZE specify browser viewport size in pixels, for example "1280x720" |
The installed skill includes detailed reference guides for common tasks:
- Running and Debugging Playwright tests — run, debug and manage Playwright test suites
- Request mocking — intercept and mock network requests
- Running Playwright code — execute arbitrary Playwright scripts
- Browser session management — manage multiple browser sessions
- Storage state (cookies, localStorage) — persist and restore browser state
- Test generation (plan / generate / heal) — generate Playwright tests from a spec or interactions
- Tracing — record and inspect execution traces
- Video recording — capture browser session videos
- Inspecting element attributes — get element id, class, or any attribute not visible in the snapshot