Files
2026-10-09 14:00:40 +02:00

19 lines
743 B
JavaScript

import { chromium } from 'playwright';
const [,, url, prefix, selector, width = '1440'] = process.argv;
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: Number(width), height: 1100 } });
await page.goto(url, { waitUntil: 'networkidle' });
const root = page.locator(selector);
const tabs = root.locator('[role="tab"]');
const n = await tabs.count();
for (let i = 0; i < n; i++) {
await tabs.nth(i).click();
await page.waitForTimeout(450);
const stage = root.locator('[data-stage-item][data-active]').first();
await stage.scrollIntoViewIfNeeded();
await page.waitForTimeout(200);
await stage.screenshot({ path: `${prefix}-${i}.png` });
}
console.log('tabs', n);
await browser.close();