| 123456789101112131415161718192021 |
- 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: 1440, height: 900 } })).newPage();
- const clear = () => p.evaluate(() => document.querySelectorAll('vite-error-overlay').forEach(e=>e.remove()));
- await p.goto('http://localhost:4200/login', { waitUntil: 'networkidle' });
- await clear(); await p.waitForTimeout(600);
- 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/contacts', { waitUntil:'networkidle' });
- await clear(); await p.waitForTimeout(1800);
- const r = await p.evaluate(() => {
- const tb = document.querySelector('.toolbar');
- const kids = [...tb.children].map(el => ({
- tag: el.tagName, cls: String(el.className).slice(0,40),
- rect: (() => { const x = el.getBoundingClientRect(); return {x:Math.round(x.x),y:Math.round(x.y),w:Math.round(x.width),h:Math.round(x.height)}; })(),
- inner: el.innerHTML.slice(0,150),
- }));
- return kids;
- });
- console.log(JSON.stringify(r, null, 2));
- await b.close();
|