import puppeteer from 'puppeteer'; import sharp from 'sharp'; const b = await puppeteer.launch({ args:['--no-sandbox','--disable-setuid-sandbox','--use-gl=angle','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] }); const p = await b.newPage(); await p.setViewport({width:1100,height:1300}); await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000}); await new Promise(r=>setTimeout(r,1200)); await p.evaluate(()=>document.querySelector('[data-shader-demo]').scrollIntoView({block:'center'})); await new Promise(r=>setTimeout(r,600)); async function shot(){ const el=await p.$('[data-shader-demo]'); await el.screenshot({path:'/tmp/a.png'}); const {data,info}=await sharp('/tmp/a.png').raw().toBuffer({resolveWithObject:true}); return {w:info.width,h:info.height,data}; } const s1=await shot(); await new Promise(r=>setTimeout(r,800)); const s2=await shot(); // сравним центральные пиксели function center(d,info){ const i=((info.height>>1)*info.width+(info.width>>1))*3; return [d[i],d[i+1],d[i+2]]; } const c1=center(s1.data,s1), c2=center(s2.data,s2); console.log('center px t1:', c1, ' t2:', c2, ' MOVED:', JSON.stringify(c1)!==JSON.stringify(c2)); await b.close();