SPB Git

spb/autoscholar

Public
971 B · 9 lines javascript
1import { chromium, devices } from "@playwright/test";2const b = await chromium.launch(); const ctx = await b.newContext({ ...devices["iPhone 14"], viewport: { width: 390, height: 844 } }); const page = await ctx.newPage();3for (const path of ["/", "/research", "/research/as-wp-2026-0000-staging-sample"]) {4  await page.goto("http://localhost:8471" + path, { waitUntil: "networkidle" });5  const r = await page.evaluate(() => { const vw = document.documentElement.clientWidth; const out = []; for (const el of document.querySelectorAll("body *")) { const r = el.getBoundingClientRect(); if (r.right > vw + 1 && r.width > 40) out.push(`${el.tagName.toLowerCase()}.${(el.className && typeof el.className === "string" ? el.className.split(" ").slice(0,3).join(".") : "")} right=${Math.round(r.right)} w=${Math.round(r.width)}`); } return { sw: document.documentElement.scrollWidth, vw, out: out.slice(0, 8) }; });6  console.log(path, JSON.stringify(r));7}8await b.close();9
Files · b1229548352bd25ab6d221039426fecbffb2b0fa
Menu

Theme