import {chromium} from 'playwright'; const b = await chromium.launch({channel: 'chrome'}); const page = await b.newPage({viewport: {width: 1280, height: 900}}); const bad = []; page.on('response', (r) => { if (r.status() >= 400 && r.url().includes('/s/stay/')) bad.push(r.status() + ' ' + decodeURIComponent(r.url().split('/s/stay/')[1])); }); await page.goto('http://localhost/s/stay', {waitUntil: 'domcontentloaded'}); await page.waitForTimeout(6000); const r = await page.evaluate(() => ({ miniBtns: [...document.querySelectorAll('#w4d-mini button')].map((b) => b.id), peoplePhotos: document.querySelectorAll('#people img').length, peopleCards: document.querySelectorAll('#people article').length, credits: [...document.querySelectorAll('#people a')].filter((a) => /CC |KOGL|Public/.test(a.textContent)).length, wrapUp: [...document.querySelectorAll('#itinerary li')].filter((li) => li.textContent.includes('마무리 ·')).length, bagPick: document.body.textContent.includes('짐 찾기 ·'), bbq: document.body.textContent.includes('바비큐 이용'), shortStay: [...document.querySelectorAll('#itinerary li')].filter((li) => /스테이 머뭄/.test(li.textContent) && /1[0-5]분/.test(li.textContent)).length, })); console.log(JSON.stringify(r)); console.log('실패요청', bad.slice(0, 6)); await page.evaluate(() => document.querySelector('#people')?.scrollIntoView()); await page.waitForTimeout(1200); await page.screenshot({path: '/tmp/s-people.png'}); await b.close();