_dbg3.mjs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  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: 1280, height: 1000 } })).newPage();
  4. const clear = () => p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove()));
  5. await p.goto('http://localhost:4200/login', { waitUntil:'networkidle' });
  6. await clear(); await p.waitForTimeout(700);
  7. const ins = await p.locator('ui-input input').all();
  8. await ins[0].fill('13800138000'); await ins[1].fill('123456');
  9. await p.getByText('登 录', { exact:false }).first().click();
  10. await p.waitForTimeout(2800);
  11. await p.goto('http://localhost:4200/desktop/contacts', { waitUntil:'networkidle' });
  12. await clear(); await p.waitForTimeout(1800);
  13. // 直接看 tabs-row / search-row 及其子元素的盒子
  14. const r = await p.evaluate(() => {
  15. const pick = (sel) => {
  16. const el = document.querySelector(sel);
  17. if (!el) return `${sel}: 不存在`;
  18. const b = el.getBoundingClientRect();
  19. return `${sel}: ${Math.round(b.width)}x${Math.round(b.height)} @y=${Math.round(b.y)}`;
  20. };
  21. const tabs = document.querySelector('ui-tabs');
  22. const tabsBox = tabs ? tabs.getBoundingClientRect() : null;
  23. // ui-tabs 内部结构
  24. const inner = tabs ? [...tabs.querySelectorAll('*')].map(e => {
  25. const b = e.getBoundingClientRect();
  26. return `${e.tagName}.${String(e.className).slice(0,40)} ${Math.round(b.width)}x${Math.round(b.height)}`;
  27. }).slice(0,6) : [];
  28. return {
  29. tabsRow: pick('.tabs-row'),
  30. searchRow: pick('.search-row'),
  31. searchBox: pick('.search-box'),
  32. tabsInternal: inner,
  33. };
  34. });
  35. console.log(JSON.stringify(r, null, 2));
  36. await b.close();