Files

17 lines
986 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();
await p.setViewport({width:1280,height:1000});
await p.goto('http://10.200.201.3:4175/_lab/neu-card.html',{waitUntil:'load',timeout:60000});
await new Promise(r=>setTimeout(r,1000));
await p.evaluate(()=>{ window.__clicked=false; const c=document.querySelector('#sec-shader a.contact-card'); c.addEventListener('click',()=>window.__clicked=true,true); });
const link = await p.$('#sec-shader a.contact-card');
await link.hover();
await new Promise(r=>setTimeout(r,400));
const hover = await p.evaluate(()=>getComputedStyle(document.querySelector('#sec-shader a.contact-card')).transform);
await link.click({delay:50});
await new Promise(r=>setTimeout(r,300));
const clicked = await p.evaluate(()=>window.__clicked);
console.log(JSON.stringify({hover, clicked},null,1));
await b.close();