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:1280,height:1400,deviceScaleFactor:1}); await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000}); await new Promise(r=>setTimeout(r,2000)); const el = await p.$('#sec-shader'); await el.screenshot({ path: '/tmp/shader-sec.png' }); // analyse average + stddev of color const {data,info} = await sharp('/tmp/shader-sec.png').raw().toBuffer({resolveWithObject:true}); let n=info.width*info.height, rs=0,gs=0,bs=0; const cols=new Set(); for(let i=0;i>4},${data[i+1]>>4},${data[i+2]>>4}`); } console.log('avg rgb', Math.round(rs/n),Math.round(gs/n),Math.round(bs/n)); console.log('distinct coarse colors sampled:', cols.size); await b.close();