SPB Git

spb/phi-conseil

Public
801 B · 19 lines javascript
1import { chromium } from "@playwright/test";2const b = await chromium.launch();3const p = await b.newPage({ viewport: { width: 360, height: 800 } });4await p.goto(process.argv[2] ?? "http://127.0.0.1:3100/", { waitUntil: "networkidle" });5const r = await p.evaluate(() => {6  const w = document.documentElement.clientWidth;7  const out = [];8  for (const el of document.querySelectorAll("body *")) {9    const r = el.getBoundingClientRect();10    if (r.right > w + 1 || r.left < -1)11      out.push(12        `${el.tagName.toLowerCase()}.${[...el.classList].slice(0, 4).join(".")} left=${Math.round(r.left)} right=${Math.round(r.right)}`,13      );14  }15  return { scrollWidth: document.documentElement.scrollWidth, w, out: out.slice(0, 25) };16});17console.log(JSON.stringify(r, null, 1));18await b.close();19
Files · main
Menu

Theme