{
  "slug": "playwright-browsercontext-mirrors-page-lifecycle-events-60080847de41",
  "title": "Playwright BrowserContext mirrors page lifecycle events",
  "tools": [
    "playwright"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-05-11T19:08:18.000Z",
  "announced_at": "2026-05-11T19:08:18.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When monitoring lifecycle activity across every page in a browser context, register listeners on the `BrowserContext` for the events you need. Each callback receives a `Download`, `Frame`, or `Page`, as documented for that event.",
    "examples": [
      "context.on('download', download => {});\ncontext.on('frameattached', frame => {});\ncontext.on('framedetached', frame => {});\ncontext.on('framenavigated', frame => {});\ncontext.on('pageclose', page => {});\ncontext.on('pageload', page => {});"
    ],
    "gotchas": [
      "Version: v1.60.0",
      "event name (`download`, `frameattached`, `framedetached`, `framenavigated`, `pageclose`, or `pageload`) (required): Selects which context event to listen for. The events report a download starting, a frame attaching/detaching/navigating, a page closing, or a page's JavaScript `load` event being dispatched, respectively.",
      "listener callback (`data => {}`) (required): Receives the event data: `Download` for `download`, `Frame` for the three frame events, and `Page` for `pageclose` and `pageload`.",
      "Prerequisite: Use Playwright v1.60.0 or later; the six context event APIs are documented as added in v1.60."
    ]
  },
  "why_it_matters": "Monitor downloads, frame lifecycle, page closure, and page load across pages in a browser context.",
  "sources": [
    "https://github.com/microsoft/playwright/releases/tag/v1.60.0",
    "https://playwright.dev/docs/api/class-browsercontext"
  ],
  "rank": 0.99044,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-15228fe3d33f40e5-6:gate",
    "evidence_hash": "8d2217b180ed48f8295026249b4e63507609b51ecea3842ff24b521ee9c9c11e"
  },
  "review": {
    "draft_hash": "ca535eac1cea16b24da2f69fdaaa0b9d57ad8ba18602f7f2e95c9096f608ed06",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.99 >= 0.9; 2 needed) and Jev gave 0.73 (>= 0.6 needed)."
  }
}
