import { chromium } from "playwright"; const b = await chromium.launch(); const p = await (await b.newContext({ viewport: { width: Number(process.argv[3] ?? 375), height: 812 } })).newPage(); await p.goto(process.argv[2], { waitUntil: "networkidle", timeout: 90000 }); const out = await p.evaluate(() => { const w = window.innerWidth; const res = []; for (const el of document.querySelectorAll("body *")) { const r = el.getBoundingClientRect(); if (r.right > w + 2 && r.width < 5000) res.push({ tag: el.tagName, cls: (el.className || "").toString().slice(0, 90), right: Math.round(r.right), text: (el.textContent || "").trim().slice(0, 60) }); } return res.slice(0, 12); }); console.log(JSON.stringify(out, null, 1)); await b.close();