const { chromium } = require('playwright'); (async () => { const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 1400, height: 900 } }); const errs = []; p.on('pageerror', (e) => errs.push(e.message.slice(0, 120))); p.on('console', (m) => { if (m.type() === 'error') errs.push(m.text().slice(0, 120)) }); await p.goto('http://127.0.0.1:8792/', { waitUntil: 'load' }); await p.waitForTimeout(3000); await p.click('button:has-text("新建画布")').catch(() => {}); await p.waitForTimeout(2500); const info = await p.evaluate(() => { const styles = Array.prototype.map.call(document.querySelectorAll('head style'), (s) => ({ id: s.id || s.getAttribute('data-plugin') || '(none)', len: s.textContent.length })); const pluginStyles = styles.filter((x) => x.id !== '(none)' || x.len > 0); return { styleCount: styles.length, nonEmpty: styles.filter((s) => s.len > 0).length, pluginStyles, dockButtons: Array.prototype.map.call(document.querySelectorAll('.iwb-dock-btn'), (b) => b.getAttribute('data-tip') || b.getAttribute('aria-label') || b.textContent.trim()).slice(0, 12), }; }); console.log(JSON.stringify(info, null, 1).slice(0, 1200)); console.log('errors:', JSON.stringify(errs.slice(0, 5))); await b.close(); })().catch((e) => { console.error('ERR', e.message); process.exit(1) });