SPB Git forge

spb/uqo-eval

Public
55commits 2branches 0releases
134.4 MBsize
maindefault branch
3 h agolast push
TypeScript 90.1% JavaScript 3.2% Python 3.2% CSS 1.8% HTML 1.8%
741 B · 12 lines javascript
Raw Blame History
1import { chromium } from "playwright";2const b = await chromium.launch();3const p = await (await b.newContext({ viewport: { width: Number(process.argv[3] ?? 375), height: 812 } })).newPage();4await p.goto(process.argv[2], { waitUntil: "networkidle", timeout: 90000 });5const out = await p.evaluate(() => {6  const w = window.innerWidth; const res = [];7  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) }); }8  return res.slice(0, 12);9});10console.log(JSON.stringify(out, null, 1));11await b.close();12