import {chromium} from 'playwright'; const b = await chromium.launch({channel: 'chrome'}); const p = await b.newPage({viewport: {width: 390, height: 780}, isMobile: true, hasTouch: true}); await p.goto('http://localhost/s/stay', {waitUntil: 'domcontentloaded'}); await p.waitForTimeout(5000); await p.evaluate(() => { const rail = [...document.querySelectorAll('#gallery *')].find((el) => { const s = getComputedStyle(el); return /auto|scroll/.test(s.overflowX) && el.scrollWidth - el.clientWidth > 40; }); rail.dataset.w4dArrow = '1'; rail.scrollIntoView({block: 'center'}); }); await p.waitForTimeout(700); const read = () => p.evaluate(() => Math.round(document.querySelector('[data-w4d-arrow]').scrollLeft)); // ① 사람이 민다 (트러스티드 드래그) const bb = await (await p.$('[data-w4d-arrow]')).boundingBox(); await p.mouse.move(bb.x + bb.width * 0.7, bb.y + bb.height / 2); await p.mouse.down(); await p.mouse.move(bb.x + bb.width * 0.2, bb.y + bb.height / 2, {steps: 10}); await p.mouse.up(); await p.waitForTimeout(800); const afterSwipe = await read(); // ② 자동으로 더 넘어가는지 6초 await p.waitForTimeout(6000); const afterIdle = await read(); // ③ 화살표를 누르면 여전히 넘어가는지 const next = await p.$('#gallery button[aria-label="다음 사진"]'); let arrowWorks = null; if (next) { const before = await read(); await next.click(); await p.waitForTimeout(900); arrowWorks = (await read()) - before; } console.log(JSON.stringify({afterSwipe, afterIdle, 자동이동: afterIdle - afterSwipe, 화살표이동: arrowWorks})); await b.close();