-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-page.js
More file actions
43 lines (33 loc) · 1.11 KB
/
debug-page.js
File metadata and controls
43 lines (33 loc) · 1.11 KB
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
33
34
35
36
37
38
39
40
41
42
43
import { chromium } from '@playwright/test';
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
// Capture console messages
page.on('console', (msg) => {
console.log(`[BROWSER CONSOLE ${msg.type()}]:`, msg.text());
});
// Capture page errors
page.on('pageerror', (err) => {
console.error('[BROWSER ERROR]:', err.message);
});
await page.goto('http://localhost:5177/');
// Wait a bit for page to load
await page.waitForTimeout(2000);
// Take screenshot
await page.screenshot({
path: '/tmp/test-app-screenshot.png',
fullPage: true,
});
console.log('Screenshot saved to /tmp/test-app-screenshot.png');
// Get page content
const content = await page.content();
console.log('\n[PAGE HTML]:\n', content.substring(0, 500));
// Check if app element exists
const appElement = await page.$('#app');
console.log('\n[APP ELEMENT]:', appElement ? 'Found' : 'Not found');
if (appElement) {
const html = await appElement.innerHTML();
console.log('[APP INNER HTML]:', html.substring(0, 500));
}
await browser.close();
})();