set_page_data
Bypasses CDP's 1 MB per-message limit by chunking large payloads into window.__pb_data for debugging or stubbing responses in the browser.
Instructions
Write a large payload (>1 MB) to window.__pb_data[key] in the page, bypassing the CDP 1 MB-per-message limit via server-side chunking. Use when: passing big base64 images / JSON / fixtures to a debug hook (window.__yourHook(data)), stubbing fetch responses with large bodies, or feeding binary data to a custom drop-zone. Sources: inline (pass data directly — useful for known small payloads) or file (pass absolute path, server reads as binary). After this call the page can read window.__pb_data[''] (string OR ArrayBuffer depending on encoding) and window.__pb_data['__complete'] === true once all chunks landed. Note: each call chunks sequentially over the CDP WebSocket — do NOT issue multiple set_page_data calls for the same key in parallel; concurrent writes would race on window.__pb_data[key]. Do NOT use for: small (<200 KB) payloads where a single evaluate works, or where file_upload with an would suffice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Property name under window.__pb_data (JS identifier — letters, digits, underscore; cannot start with digit) | |
| source | Yes | Where to read the payload from. type 'inline' → pass `data` as a string. type 'file' → pass absolute `path`; the server reads the file as binary. | |
| encoding | No | Encoding interpretation. 'utf8' (default for inline) keeps the data as a string. 'binary' (default for file) decodes to ArrayBuffer in the page so apps can pass it to FileReader / Blob / fetch body. 'base64' keeps the base64 string as-is (the page can decode it itself). | |
| chunkSize | No | Raw bytes per chunk before base64 encoding. Default 500_000 (~670 KB base64, safe under CDP's 1 MB-per-message limit). Capped at 700_000 (~933 KB base64) to leave safety margin. |