zshot/cliDownload

--cdp

CLI
--cdp
REST
CLI only
ValueHOST:PORT
LicensePro

Start a server using the Chrome DevTools Protocol, so a Playwright, Puppeteer or other CDP client can control ZShot.

FormBehavior
--cdp HOST:PORTPrints the endpoint, ws://HOST:PORT/devtools/browser/<token>, on stdout and serves until ZShot is stopped
--cdp -- COMMANDServes on a loopback port the system picks, runs COMMAND with ZSHOT_CDP_URL set to the endpoint, and exits with its exit code, or 127 when it cannot start
--cdp HOST:PORT -- COMMANDAs above, on HOST:PORT

The endpoint’s path carries a random token, and a client needs the whole URL to connect. The command receives the environment ZShot started with; Ctrl-C reaches it directly, and a SIGTERM sent to ZShot is passed on. --cdp-webdriver adds chromedriver’s attach for WebDriver clients.

Cannot be combined with --server, --mcp-local-server, a URL, -f, -t or --navigate. Each new browser context starts from the storage flags given at startup.

Warning: Window Resizing Is Poorly Supported

The browser has no window. Size a page with the client’s viewport call, such as Playwright’s page.setViewportSize, rather than by resizing its window.

Example

Serve on port 9222:

CLI Run locally
zshot --cdp 127.0.0.1:9222

Run a Playwright script against ZShot, with capture.mjs:

import { chromium } from "playwright-core";

const browser = await chromium.connectOverCDP(process.env.ZSHOT_CDP_URL);
const page = await browser.contexts()[0].newPage();
await page.goto("https://zshot-cli.com/example_assets/hello_zshot/");
await page.screenshot({ path: "hello.png" });
console.log(await page.title());
await browser.close();
CLI Run locally
zshot --cdp -- node capture.mjs