import { chromium } from '@playwright/test'; (async () => { const browser = await chromium.launch({ headless: true }); const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }); console.log('正在访问首页...'); await page.goto('http://localhost:3000'); await page.waitForLoadState('networkidle'); await page.waitForTimeout(2000); // 滚动到 Case Studies 区域 await page.evaluate(() => { const sections = document.querySelectorAll('section'); for (const s of sections) { if (s.textContent?.includes('可衡量的业务成果')) { s.scrollIntoView({ behavior: 'smooth' }); break; } } }); await page.waitForTimeout(1500); // 截图 Case Studies 区域 await page.screenshot({ path: '/tmp/screenshots/case-studies-fixed.png' }); console.log('✓ Case Studies 区域截图已保存'); await browser.close(); console.log('\n截图完成!'); })();