25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
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,1200));
|
||
const r = await p.evaluate(()=>{
|
||
const card=document.querySelector('#sec-shader a.contact-card');
|
||
const rect=card.getBoundingClientRect();
|
||
const x=rect.x+rect.width/2, y=rect.y+rect.height/2;
|
||
const el=document.elementFromPoint(x,y);
|
||
const path=[];
|
||
let e=el; while(e && path.length<5){ path.push(e.className||e.tagName); e=e.parentElement; }
|
||
// что у canvas
|
||
const cv=card.querySelector('canvas');
|
||
return {
|
||
topEl: el.className||el.tagName,
|
||
path,
|
||
canvasPE: cv?getComputedStyle(cv).pointerEvents:'', canvasZ: cv?getComputedStyle(cv).zIndex:'',
|
||
cardZ: getComputedStyle(card).zIndex, cardPos: getComputedStyle(card).position,
|
||
};
|
||
});
|
||
console.log(JSON.stringify(r,null,1));
|
||
await b.close();
|