--- name: capturing-browser-logs description: Gets runtime evidence from a web page the agent cannot run itself, using Agent Log (austegard.com/web-utilities/agent-log.html), a script that records console calls, errors, fetch/XHR traffic and the events and DOM changes of elements the user picks, as OpenTelemetry logs in the user's browser. Use when debugging a page, web app, browser game or bookmarklet that misbehaves on the user's device, when the user says "it doesn't work" about a page and you need to see what happened, when you want to add console.log instrumentation and read it back, when you need to see what happens on a specific button, field or element, or when the user hands you an OTLP JSON log export or a file named agent-log-*.json. metadata: version: 0.2.2 --- # Capturing browser logs The user runs the page; you read what it did. Agent Log records the page's console output, uncaught errors, unhandled rejections, failed resource loads, CSP violations and fetch/XHR calls into the browser's IndexedDB, shows a red **Logging** badge while it records, and exports an OTLP/JSON file the user hands back to you. Nothing is uploaded. Docs, bookmarklet and console snippet: https://austegard.com/web-utilities/agent-log.html ## Applicability Use it when the bug happens in a real browser that you do not control: the user's phone, a GPU-specific failure, a page behind their login, timing that a headless run does not reproduce. If you can run the page yourself in Playwright or a browser tool, do that instead and read the console directly. Agent Log does not see iframes, web workers or service workers, and it does not record request or response bodies. ## Procedure 1. **Pick how the user turns it on.** Give them exactly one route: - A page whose source you can edit: add `` to its `
`, ship it, and ask the user to open the page with `?logging=true` (or `&logging=true` when the URL already has a query). Logging stays on in that tab across reloads until they press **Stop logging**. For a page that should always log, use ``. - Any other page: ask the user to drag the bookmarklet from the docs page to their bookmarks bar, open the page and click it. - A page with a strict Content Security Policy (GitHub, many banks and mail clients): the bookmarklet silently fails there. Ask the user to press **Copy the full script** on the docs page and paste it into the page's devtools console. - `raw.githubusercontent.com` cannot serve the script to a `