import { chromium } from 'playwright'; const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 390, height: 844 } }); await p.goto('http://localhost:3214/', { waitUntil: 'domcontentloaded' }); await p.waitForTimeout(3500); await p.locator('[data-testid="mobile-menu-button"]').click(); await p.waitForTimeout(900); const drawer = p.locator('[data-testid="mobile-navigation"]'); const hrefs = await drawer.locator('a').evaluateAll(as => as.map(x => x.getAttribute('href'))); console.log('抽屉链接总数:', hrefs.length); console.log('含 /products:', hrefs.filter(h => h === '/products').length); console.log('前 12 条:', hrefs.slice(0, 12).join(' ')); const groups = await drawer.locator('ul li a').count(); console.log('二级项个数:', groups); await b.close();