import { chromium } from 'playwright'; const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 1440, height: 900 } }); await p.goto('http://localhost:3210/', { waitUntil: 'domcontentloaded' }); await p.waitForSelector('nav[aria-label="主导航"]', { timeout: 15000 }); await p.waitForTimeout(2500); const nav = p.locator('nav[aria-label="主导航"]'); console.log('BUTTONS:', await nav.locator('button').allTextContents()); console.log('LINKS:', await nav.locator('a').evaluateAll(a => a.map(x => x.getAttribute('href') + '|' + x.textContent.trim()))); // hover 能力,看面板 const cap = nav.locator('button:has-text("能力")'); console.log('cap count:', await cap.count()); if (await cap.count()) { await cap.first().hover(); await p.waitForTimeout(600); console.log('expanded:', await cap.first().getAttribute('aria-expanded')); const panel = await p.locator('[id*="dropdown"], [role="menu"], [data-testid*="mega"]').allTextContents(); console.log('PANEL texts (first 300 chars):', panel.join(' /// ').slice(0, 300)); } await b.close();