# Headless Chrome recipe

URL: https://briq.cloud/cookbook/chrome

> A headless Chromium with a WebSocket endpoint for Playwright or Puppeteer.

Tags: browser, testing

## Run it

MCP:

```ts
briq_run({
  recipe: "chrome",
  params: {
    "size": "small"
  },
  wait: true
})
```

REST:

```bash
curl -X POST https://api.briq.cloud/v1/briqs \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipe": "chrome",
    "params": {
      "size": "small"
    },
    "wait": true
  }'
# → { "briqs": [{ "id": "bq_…", … }], "outputs": { "BROWSER_WS_ENDPOINT": "…" }, … }

# ... when done, for each briq id
curl -X DELETE https://api.briq.cloud/v1/briqs/<id> \
  -H "Authorization: Bearer $BRIQ_API_KEY"
```

## Parameters

| Name | Type | Options | Default | What it does |
| --- | --- | --- | --- | --- |
| `size` | enum | small, medium, large | "small" | — |

## Outputs

Returned by `briq_run` once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

| Output | Value |
| --- | --- |
| `BROWSER_WS_ENDPOINT` | `ws://chrome.<stack>.internal:3000?token=<BROWSERLESS_TOKEN>` |
| `BROWSERLESS_URL` | `http://chrome.<stack>.internal:3000` |
| `BROWSERLESS_TOKEN` | `<BROWSERLESS_TOKEN>` |

## What it runs

| Briq | Image | Ports | Size | Volume |
| --- | --- | --- | --- | --- |
| chrome | `ghcr.io/browserless/chromium:latest` | 3000 | small | — |

## When to use it

* Tests or the agent need a real browser: Playwright, Puppeteer, PDFs, screenshots.
* You do not want Chromium where the agent runs.

Connect with `chromium.connect(BROWSER_WS_ENDPOINT)` (Playwright) or
`puppeteer.connect({ browserWSEndpoint })`.

## Tips

* **CPU hungry**: `small` handles a few pages; use `medium` or `large` for parallel tests.
  Concurrency is 4.
* **From outside briq**: `briq_expose` port 3000. The endpoint's own `token` query parameter is
  required either way. With `mode: "private"`, send the URL's token as a cookie
  (`headers: { cookie: "briq_token=…" }` in `connect`): a WebSocket client does not follow the
  redirect that turns `?briq_token=` into one.
* **HTTP helpers**: `/screenshot`, `/pdf` and `/content` on the same port.
* **No sessions, proxies or stealth**: it is a browser, not a browser platform.
