-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtake-screenshot.mjs
More file actions
32 lines (25 loc) · 938 Bytes
/
take-screenshot.mjs
File metadata and controls
32 lines (25 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
page.on('console', msg => console.log('Browser:', msg.text()));
await page.setViewportSize({ width: 1280, height: 900 });
console.log('Loading WebCalendar example...');
await page.goto('http://localhost:3001/examples/WebCalendar/', {
waitUntil: 'networkidle',
timeout: 30000
});
// Wait for the table to appear
console.log('Waiting for calendar table to render...');
try {
await page.waitForSelector('#LitCalTable', { timeout: 15000 });
console.log('Table found, waiting for full render...');
await page.waitForTimeout(3000);
} catch (e) {
console.log('Table not found after 15s, taking screenshot anyway...');
}
await page.screenshot({
path: 'docs/images/webcalendar.png',
fullPage: false
});
console.log('Screenshot saved to docs/images/webcalendar.png');
await browser.close();