import { chromium } from 'playwright'; const b = await chromium.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe' }); const p = await (await b.newContext({ viewport: { width: 1100, height: 900 } })).newPage(); await p.goto('http://localhost:4200/login', { waitUntil: 'networkidle' }); await p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove())); await p.fill('input[type="tel"]', '13800138000'); await p.fill('input[type="text"][maxlength="6"]', '123456'); await p.click('button[type="submit"]'); await p.waitForTimeout(2500); await p.goto('http://localhost:4200/desktop/chat', { waitUntil: 'networkidle' }); await p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove())); await p.waitForTimeout(2000); const info = await p.evaluate(() => { const lay = document.querySelector('.conversation-layout'); const rail = document.querySelector('.rail-col'); const cs = lay ? getComputedStyle(lay) : null; // 找出给 .conversation-layout 设过规则的样式表 let found = []; for (const sheet of document.styleSheets) { let rules; try { rules = sheet.cssRules; } catch { continue; } for (const r of rules) { if (r.selectorText && r.selectorText.includes('conversation-layout')) found.push(r.selectorText + ' → ' + r.style.gridTemplateColumns); if (r.cssRules) { for (const r2 of r.cssRules) { if (r2.selectorText && r2.selectorText.includes('conversation-layout')) found.push('[in ' + r.conditionText + '] ' + r2.selectorText + ' → ' + r2.style.gridTemplateColumns); } } } } return { innerWidth: window.innerWidth, cols: cs?.gridTemplateColumns, railDisplay: rail ? getComputedStyle(rail).display : 'none-el', matchedRules: found }; }); console.log(JSON.stringify(info, null, 2)); await b.close();