This repo contains two related tools for measuring document.createElement activity:
- a Chrome extension in the repository root for quick local inspection in the browser
- a Cloudflare Worker in
worker/that uses Browser Rendering and Playwright to count calls remotely
The live Worker is currently deployed at:
https://create-element-count-api.remi-touchless.workers.dev/
manifest.json,popup.html,popup.js,content.js,page-hook.js,background.js,sidepanel.html- unpacked browser extension for local debugging and page instrumentation
worker/- Cloudflare Worker app with the API, browser UI, tests, and Wrangler config
Endpoint:
POST /api/create-element-count
Example:
curl -X POST 'https://create-element-count-api.remi-touchless.workers.dev/api/create-element-count' \
-H 'Content-Type: application/json' \
--data '{"url":"https://example.com","timeoutMs":60000}'Example request body:
{
"url": "https://example.com",
"timeoutMs": 60000
}- Open
chrome://extensionsoredge://extensions - Enable Developer Mode
- Choose
Load unpacked - Select the repository root
cd workernpm installnpm testnpm run typechecknpm run dev
- The Worker counts
document.createElementcalls observed in the rendered page up toload. - If a page never reaches
loadbefore the timeout, the Worker returns the count gathered so far. - Browser Rendering availability can still be the limiting factor for some requests, even when the Worker itself is healthy.