# --cdp-webdriver

Source: https://zshot-cli.com/reference/flags/server/cdp-webdriver/
Markdown: https://zshot-cli.com/reference/flags/server/cdp-webdriver/index.md
Section: [Reference](https://zshot-cli.com/reference/) › [Flags](https://zshot-cli.com/reference/flags/) › [Server](https://zshot-cli.com/reference/flags/server/)
CLI: `--cdp-webdriver` · REST: CLI only
License: [Pro](https://zshot-cli.com/support/licenses/pro)

Serves chromedriver's attach beside the [`--cdp`](/reference/flags/server/cdp) endpoint, so a WebDriver client drives the browser through `goog:chromeOptions.debuggerAddress`. Requires `--cdp`.

| Addition | Value |
| --- | --- |
| `GET /json/version`, `/json/list`, `/json` | Chromium's discovery documents, naming the relay's endpoints |
| `/devtools/page/<id>` | A socket per page |
| `ZSHOT_DEBUGGER_ADDRESS` | `HOST:PORT` for the debugger address, set for a `--cdp -- COMMAND` |

Use a chromedriver of the same major version as ZShot's Chromium, which `/json/version` reports as `Browser`; another version refuses the session.

## Warning: Window Resizing Is Poorly Supported

ZShot answers WebDriver's window calls itself, since its browser has no window. Setting the window resizes the page's layout, but a screenshot keeps the browser's starting size, and the window and screen the page reads stay at their first values.

## Warning: The Attach Carries No Token

Any local process can drive the browser while ZShot runs. `--cdp` must bind a loopback address; another address exits with code 3.

## Example

Serve on port 9222:

**CLI**

```sh
zshot --cdp 127.0.0.1:9222 --cdp-webdriver
```

Run a Selenium script against ZShot, with `capture.py`:

```python
import os

from selenium import webdriver

options = webdriver.ChromeOptions()
options.debugger_address = os.environ["ZSHOT_DEBUGGER_ADDRESS"]
driver = webdriver.Chrome(options=options)
driver.get("https://zshot-cli.com/example_assets/hello_zshot/")
driver.save_screenshot("hello.png")
print(driver.title)
driver.quit()
```

**CLI**

```sh
zshot --cdp --cdp-webdriver -- python capture.py
```

## Related

Flags:

- [`--cdp`](https://zshot-cli.com/reference/flags/server/cdp/)

Topics:

- [ChromeDriver capabilities](https://developer.chrome.com/docs/chromedriver/capabilities) — goog:chromeOptions.debuggerAddress
- [Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/) — chromedriver builds by version

## Navigation

- [Examples](https://zshot-cli.com/examples/)
- [Download](https://zshot-cli.com/download/)
- [Purchase](https://zshot-cli.com/purchase/)
- [Reference](https://zshot-cli.com/reference/)
  - [Formats](https://zshot-cli.com/reference/formats/)
  - [Flags](https://zshot-cli.com/reference/flags/)
    - [Common](https://zshot-cli.com/reference/flags/common/)
    - [Agents](https://zshot-cli.com/reference/flags/agents/)
    - [Archive](https://zshot-cli.com/reference/flags/archive/)
    - [Browser](https://zshot-cli.com/reference/flags/browser/)
    - [Diagnostics](https://zshot-cli.com/reference/flags/diagnostics/)
    - [Document](https://zshot-cli.com/reference/flags/document/)
    - [Image](https://zshot-cli.com/reference/flags/image/)
    - [Navigator](https://zshot-cli.com/reference/flags/navigator/)
    - [Security](https://zshot-cli.com/reference/flags/security/)
    - [Server](https://zshot-cli.com/reference/flags/server/)
      - [--cdp](https://zshot-cli.com/reference/flags/server/cdp/)
      - **--cdp-webdriver**
      - [--server](https://zshot-cli.com/reference/flags/server/server/)
      - [--server-additional-asset-expiration](https://zshot-cli.com/reference/flags/server/server-additional-asset-expiration/)
      - [--server-basic-auth](https://zshot-cli.com/reference/flags/server/server-basic-auth/)
      - [--server-bind-address](https://zshot-cli.com/reference/flags/server/server-bind-address/)
      - [--server-bind-port](https://zshot-cli.com/reference/flags/server/server-bind-port/)
      - [--server-cache](https://zshot-cli.com/reference/flags/server/server-cache/)
      - [--server-cache-size-limit](https://zshot-cli.com/reference/flags/server/server-cache-size-limit/)
      - [--server-cache-ttl](https://zshot-cli.com/reference/flags/server/server-cache-ttl/)
      - [--server-enable-mcp](https://zshot-cli.com/reference/flags/server/server-enable-mcp/)
      - [--server-enable-prometheus](https://zshot-cli.com/reference/flags/server/server-enable-prometheus/)
      - [--server-enable-schema](https://zshot-cli.com/reference/flags/server/server-enable-schema/)
      - [--server-max-concurrency](https://zshot-cli.com/reference/flags/server/server-max-concurrency/)
      - [--server-prometheus-auth](https://zshot-cli.com/reference/flags/server/server-prometheus-auth/)
      - [--server-prometheus-bind-address](https://zshot-cli.com/reference/flags/server/server-prometheus-bind-address/)
      - [--server-prometheus-bind-port](https://zshot-cli.com/reference/flags/server/server-prometheus-bind-port/)
      - [--server-queue-requests](https://zshot-cli.com/reference/flags/server/server-queue-requests/)
      - [--server-signed-url](https://zshot-cli.com/reference/flags/server/server-signed-url/)
      - [--server-signed-url-max-age](https://zshot-cli.com/reference/flags/server/server-signed-url-max-age/)
      - [--server-token-auth](https://zshot-cli.com/reference/flags/server/server-token-auth/)
      - [--server-update-adblock-interval](https://zshot-cli.com/reference/flags/server/server-update-adblock-interval/)
      - [--server-update-blocklist-interval](https://zshot-cli.com/reference/flags/server/server-update-blocklist-interval/)
    - [Video](https://zshot-cli.com/reference/flags/video/)
  - [Agents](https://zshot-cli.com/reference/agents/)
  - [Configuration](https://zshot-cli.com/reference/configuration/)
  - [Crawling](https://zshot-cli.com/reference/crawling/)
  - [Docker](https://zshot-cli.com/reference/docker/)
  - [Exit Codes](https://zshot-cli.com/reference/exit_codes/)
  - [Linux](https://zshot-cli.com/reference/linux/)
  - [LLM Connections](https://zshot-cli.com/reference/llm_connections/)
  - [LLM Formatting](https://zshot-cli.com/reference/llm_formatting/)
  - [Local Inputs](https://zshot-cli.com/reference/inputs/)
  - [Navigator](https://zshot-cli.com/reference/navigator/)
  - [Security](https://zshot-cli.com/reference/security/)
  - [Server](https://zshot-cli.com/reference/server/)
  - [Shell completions](https://zshot-cli.com/reference/shell_completions/)
  - [Storage](https://zshot-cli.com/reference/storage/)
  - [Timeouts](https://zshot-cli.com/reference/timeouts/)
  - [Web Bot Auth](https://zshot-cli.com/reference/web_bot_auth/)
- [Support](https://zshot-cli.com/support/)
- [Changelog](https://zshot-cli.com/changelog/)

Site index: https://zshot-cli.com/llms.txt

