29 lines
944 B
JavaScript
29 lines
944 B
JavaScript
import { chromium } from '/home/node/.openclaw/workspace/node_modules/playwright/index.mjs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const htmlPath = 'file://' + path.join(__dirname, 'affiche-soldes.html');
|
|
const outPath = path.join(__dirname, 'affiche-soldes.png');
|
|
|
|
const browser = await chromium.launch({
|
|
executablePath: '/home/node/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome',
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
|
});
|
|
|
|
const page = await browser.newPage();
|
|
await page.setViewportSize({ width: 600, height: 900 });
|
|
await page.goto(htmlPath, { waitUntil: 'networkidle' });
|
|
|
|
// Petite pause pour le rendu des emojis
|
|
await page.waitForTimeout(500);
|
|
|
|
await page.screenshot({
|
|
path: outPath,
|
|
clip: { x: 0, y: 0, width: 600, height: 900 },
|
|
type: 'png',
|
|
});
|
|
|
|
await browser.close();
|
|
console.log('✅ Screenshot:', outPath);
|