import { chromium } from "@playwright/test"; const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 360, height: 800 } }); await p.goto(process.argv[2] ?? "http://127.0.0.1:3100/", { waitUntil: "networkidle" }); const r = await p.evaluate(() => { const w = document.documentElement.clientWidth; const out = []; for (const el of document.querySelectorAll("body *")) { const r = el.getBoundingClientRect(); if (r.right > w + 1 || r.left < -1) out.push( `${el.tagName.toLowerCase()}.${[...el.classList].slice(0, 4).join(".")} left=${Math.round(r.left)} right=${Math.round(r.right)}`, ); } return { scrollWidth: document.documentElement.scrollWidth, w, out: out.slice(0, 25) }; }); console.log(JSON.stringify(r, null, 1)); await b.close();