2021-07-09 18:24:05 +09:00
|
|
|
const { chromium } = require("playwright");
|
|
|
|
|
|
|
|
async function main() {
|
|
|
|
const browser = await chromium.launch({
|
|
|
|
headless: false,
|
|
|
|
});
|
|
|
|
const context = await browser.newContext();
|
|
|
|
const page = await context.newPage();
|
|
|
|
await page.goto("about:blank");
|
2021-07-13 17:26:53 +09:00
|
|
|
for (let i = 0 /* NOP */; ; i++) {
|
|
|
|
try {
|
2021-07-09 18:24:05 +09:00
|
|
|
const seq = i.toString().padStart(6, "0");
|
|
|
|
const title = await page.title();
|
|
|
|
const date = new Date().toISOString().split("T")[0];
|
|
|
|
const path = `screenshot/${date}/${seq}-${title}.png`;
|
|
|
|
await page.screenshot({ path });
|
|
|
|
await page.waitForTimeout(1_000);
|
2021-07-13 17:26:53 +09:00
|
|
|
} catch {
|
|
|
|
// NOP
|
2021-07-09 18:24:05 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
await page.close();
|
|
|
|
await context.close();
|
|
|
|
await browser.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|