Initial commit 🚀
This commit is contained in:
commit
fd58a8d32f
235 files changed
+19775
No files matched your search
@@ -0,0 +1,18 @@
|
||||
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();
|
||||
Reference in new issue
Block a user