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)); const top = await p.evaluate(()=>{ const r=document.querySelector('[data-shader-demo]').getBoundingClientRect(); return r.top+window.scrollY; }); await p.evaluate((t)=>window.scrollTo(0, t-150), top); await new Promise(r=>setTimeout(r,800)); await p.screenshot({path:'/tmp/sec.png'}); const rect = await p.evaluate(()=>{ const r=document.querySelector('[data-shader-demo]').getBoundingClientRect(); return {x:r.x,y:r.y,w:r.width,h:r.height}; }); const {data,info}=await sharp('/tmp/sec.png').raw().toBuffer({resolveWithObject:true}); const x0=Math.floor(rect.x), y0=Math.floor(rect.y), x1=Math.floor(rect.x+rect.w), y1=Math.floor(rect.y+rect.h); let maxR=0,maxG=0,maxB=0, brightPx=0, n=0; for(let y=Math.max(0,y0);y250) brightPx++; n++; } console.log('max channel values in demo card:', maxR, maxG, maxB, 'bright pixels:', brightPx, '/', n); await b.close();