const { chromium } = require('playwright-core'); (async () => { const CHROME = String.raw`C:\Program Files\Google\Chrome\Application\chrome.exe`; const browser = await chromium.launch({ executablePath: CHROME, headless: true }); const page = await browser.newPage({ viewport: { width: 1366, height: 850 } }); const base = 'http://127.0.0.1:8010'; const r = await fetch(base + '/api/auth/login', { method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({phone:'13943441149',password:'Test1234'}) }); const tok = (await r.json()).access_token; await page.goto('http://127.0.0.1:5175/login'); await page.evaluate(t => { localStorage.setItem('access_token', t); localStorage.setItem('refresh_token','r'); }, tok); await page.goto('http://127.0.0.1:5175/exercise'); await page.waitForTimeout(2500); await page.locator('.tpl-btn').first().click(); await page.waitForTimeout(1500); const cards = await page.locator('.tg-card').count(); const ours = ['知识分类','序列记忆','成语接龙','定时炸弹','入门数独']; const bad = []; for (let i = 0; i < cards; i++) { const errs = []; const handler = e => errs.push(e.message); page.on('pageerror', handler); await page.locator('.tg-card').nth(i).click(); await page.waitForTimeout(1000); const name = (await page.locator('.tg-main-head h3').textContent().catch(()=> '') || '').trim(); page.off('pageerror', handler); if (errs.length) bad.push({ i, name, errs: errs.slice(0,2) }); } console.log('BAD_GAMES:', JSON.stringify(bad, null, 2)); await browser.close(); })();