import { chromium } from 'playwright'; const BASE = 'http://localhost:9027'; (async () => { const browser = await chromium.launch(); const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const page = await ctx.newPage(); await page.goto(`${BASE}/view/mhzc/home`, { waitUntil: 'networkidle', timeout: 30000 }); await page.waitForSelector('.capability-section', { timeout: 20000 }); await page.evaluate(() => { const el = document.getElementById('section-capability'); if (el) el.scrollIntoView({ behavior: 'instant', block: 'start' }); }); await page.waitForTimeout(800); await page.locator('.capability-card').nth(0).click(); await page.waitForTimeout(3500); // 检查视口不同位置是什么元素 const points = await page.evaluate(() => { const results = []; const pts = [[720, 100], [720, 300], [720, 500], [720, 700], [200, 200], [1200, 200], [720, 850]]; for (const [x, y] of pts) { const els = document.elementsFromPoint(x, y); results.push({ x, y, els: els.slice(0, 5).map((el) => ({ tag: el.tagName, cls: (el.className || '').slice(0, 80), id: el.id })) }); } return results; }); console.log('points:'); for (const p of points) { console.log(` (${p.x},${p.y}):`, JSON.stringify(p.els)); } await browser.close(); })().catch((e) => { console.error('TEST ERROR', e); process.exit(1); });