import { chromium } from 'playwright' const b = await chromium.launch({ executablePath: '/home/box/.cache/ms-playwright/chromium-1248/chrome-linux64/chrome' }) const p = await b.newPage({ viewport: { width: 1280, height: 720 } }) for (const id of ['elephant', 'secret-gateway', 'primitives-manifest', 'agent-buttons']) { await p.goto(`file:///workspace/kpkg/cf-connect-pse/dist/index.html?static#/${id}`) await p.waitForFunction(() => window.__deck?.isReady()) console.log(id, JSON.stringify(await p.evaluate(() => { const host = window.__widgets.find((w) => w.slide === window.__deck.getCurrentSlide()) const st = host.stage.getBoundingClientRect(), pw = host.pw.getBoundingClientRect() const run = host.stage.querySelector('.pw-run') || host.stage const kids = [...run.querySelectorAll(':scope > *')].map((e) => { const r = e.getBoundingClientRect(); return [e.tagName + '.' + (e.getAttribute('class') || '').split(' ')[0], Math.round(r.left - st.left), Math.round(r.top - st.top), Math.round(r.width), Math.round(r.height)] }) return { pw: [Math.round(pw.width), Math.round(pw.height)], stage: [Math.round(st.left - pw.left), Math.round(st.top - pw.top), Math.round(st.width), Math.round(st.height)], kids } }))) } await b.close()