19 lines
989 B
JavaScript
19 lines
989 B
JavaScript
import puppeteer from 'puppeteer';
|
|
const b = await puppeteer.launch({ args:['--no-sandbox','--disable-setuid-sandbox','--use-gl=angle','--enable-unsafe-swiftshader'] });
|
|
const p = await b.newPage();
|
|
const errs=[]; p.on('console',m=>{ if(m.type()==='error') errs.push(m.text()); });
|
|
p.on('pageerror',e=>errs.push('PAGEERR '+e.message));
|
|
await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000});
|
|
const cards = await p.$$eval('#sec-contact .contact-card', els => els.map(e=>{
|
|
const cs = getComputedStyle(e);
|
|
const before = getComputedStyle(e,'::before');
|
|
const img = e.querySelector('img');
|
|
return { name:e.querySelector('.contact-card__name')?.textContent,
|
|
boxShadow: cs.boxShadow.slice(0,40),
|
|
beforeBg: before.backgroundImage.slice(0,60),
|
|
borderW: cs.borderTopWidth,
|
|
imgLoaded: img ? (img.complete && img.naturalWidth>0) : 'no-img' };
|
|
}));
|
|
console.log(JSON.stringify({count:cards.length, cards, errs}, null, 1));
|
|
await b.close();
|