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(1500); // ui-input 内部是原生 input,直接按位置填 const inputs = await p.locator('ui-input input').all(); console.log('找到 ui-input 内原生 input 数量:', inputs.length); if (inputs.length >= 2) { await inputs[0].fill('13800138000'); await inputs[1].fill('123456'); } // 提交按钮:找「登 录」文本 await p.getByText('登 录', { exact: false }).first().click(); await p.waitForTimeout(3500); console.log('登录后 URL:', p.url()); await clear(); await p.goto('http://localhost:4200/desktop/mine', { waitUntil: 'networkidle' }); await clear(); await p.waitForTimeout(2500); await p.screenshot({ path: '../../.shots/v2-mine.png' }); const probe = await p.evaluate(() => { const thumbs = [...document.querySelectorAll('.thumb')].map(t => { const nav = t.querySelector('.thumb-nav'), main = t.querySelector('.thumb-main'); return { palette: t.getAttribute('data-preview-palette'), navBg: nav ? getComputedStyle(nav).backgroundColor : '-', mainBg: main ? getComputedStyle(main).backgroundColor : '-', }; }); return { thumbCount: thumbs.length, thumbs, hasUsageSection: /使用端/.test(document.body.innerText), }; }); console.log('\n=== 我的页 ==='); console.log('缩略图数量:', probe.thumbCount); probe.thumbs.forEach(t => console.log(` ${(t.palette||'').padEnd(10)} nav=${t.navBg} main=${t.mainBg}`)); console.log('「使用端」区块仍存在:', probe.hasUsageSection); await p.screenshot({ path: '../../.shots/v2-mine-final.png' }); await b.close();