const puppeteer = require('puppeteer'); async function probePage(browser, url, width) { const page = await browser.newPage(); await page.setViewport({ width, height: 900, deviceScaleFactor: 1 }); await page.goto(url, { waitUntil: 'networkidle0' }); await page.waitForSelector('[data-mini-projects-list] .mini-projects-grid__item', { timeout: 15000 }).catch(()=>{}); await new Promise(r => setTimeout(r, 700)); const data = await page.evaluate(() => { const list = document.querySelector('[data-mini-projects-list]'); if (!list) return { none: true }; const inner = list.closest('.section__inner'); const items = [...list.querySelectorAll('.mini-projects-grid__item')].filter(i => !i.hidden); const rowCells = (() => { const w = list.clientWidth; if (w >= 1180) return 6; if (w >= 880) return 4; if (w >= 520) return 2; return 1; })(); return { listWidth: list.clientWidth, innerWidth: inner ? inner.clientWidth : null, rowCells, itemCount: items.length, items: items.map(i => ({ cells: i.getAttribute('data-mp-cells'), styleW: i.style.width, x: i.style.transform, })), }; }); await page.close(); return data; } (async () => { const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox','--disable-setuid-sandbox'] }); const widths = [600, 760, 900, 1024, 1180, 1278, 1356, 1600]; const caseUrl = 'http://localhost:4175/cases/ai-platform-primo-rpa/'; const homeUrl = 'http://localhost:4175/'; for (const w of widths) { const c = await probePage(browser, caseUrl, w); console.log(`CASE vw=${w} inner=${c.innerWidth} rowCells=${c.rowCells} items=${c.itemCount} ` + JSON.stringify(c.items)); } console.log('---'); for (const w of widths) { const h = await probePage(browser, homeUrl, w); console.log(`HOME vw=${w} inner=${h.innerWidth} rowCells=${h.rowCells} items=${h.itemCount} ` + JSON.stringify(h.items)); } await browser.close(); })().catch(e => { console.error(e); process.exit(1); });