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="主导航"]'); for (const label of ['行业', '能力', '洞察']) { const btn = nav.locator(`button:has-text("${label}")`); await p.mouse.move(0, 0); await p.waitForTimeout(200); await btn.hover(); await p.waitForTimeout(700); const expanded = await btn.getAttribute('aria-expanded'); const controls = await btn.getAttribute('aria-controls'); const links = await p.locator('a').evaluateAll(a => a.map(x => x.getAttribute('href')).filter(h => h && (h.startsWith('/solutions') || h.startsWith('/services') || h.startsWith('/products') || h.startsWith('/insights') || h.startsWith('/news') || h.startsWith('/methodology')))); const viewAll = await p.locator('a:has-text("查看全部")').evaluateAll(a => a.map(x => x.textContent.trim() + ' -> ' + x.getAttribute('href'))); console.log(`\n### ${label} expanded=${expanded} controls=${controls}`); console.log(' 面板内相关链接:', [...new Set(links)].join(' ')); console.log(' 查看全部:', viewAll.join(' | ')); } await b.close();