Files
libretro/website/tools/shot_element.mjs
T
Abdessamad Derraz 294942afd0 feat: port the site ports and picker checks
Tables with a download link stack on phones, the browser check covers
the lookup, a hash typed in the search, breadcrumbs, previous and next
across tabs, glossary terms and the 404 hint. validate_site budgets the
Pagefind index pieces and takes the base path without mkdocs.yml. A
test holds the picker to install.narrow() on 180 selections.
2026-10-22 15:46:36 +02:00

14 lines
712 B
JavaScript

// Screenshot of one element of a page, to look at a component closely.
// node shot_element.mjs <url> <css selector> <out.png> [width] [light|dark]
import { chromium } from 'playwright-core';
const [url, selector, out, width = '390', scheme = 'light'] = process.argv.slice(2);
const browser = await chromium.launch({ executablePath: '/usr/bin/google-chrome' });
const page = await browser.newPage({ viewport: { width: Number(width), height: 900 }, colorScheme: scheme });
await page.goto(url, { waitUntil: 'networkidle' });
const element = page.locator(selector).first();
await element.scrollIntoViewIfNeeded();
await page.waitForTimeout(300);
await element.screenshot({ path: out });
await browser.close();