_dbg.mjs 1.8 KB

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