const sleep = ms => new Promise(r => setTimeout(r, ms)); const propsOf = el => { for (const k of Object.keys(el)) if (k.startsWith('__reactProps$')) return el[k]; return null; }; const fire = (el) => { let t = el; for (let i=0;i<8&&t;i++){const q=propsOf(t); if(q&&typeof q.onClick==='function'){q.onClick({target:t,currentTarget:t,stopPropagation(){},preventDefault(){},nativeEvent:{},button:0,detail:1});return true;} t=t.parentElement;} return false; }; const leaf = (txt) => { for (const el of document.querySelectorAll('*')) if (el.children.length===0 && (el.textContent||'').trim()===txt) return el; return null; }; fire(leaf('布线')); await sleep(800); fire(leaf('自动布线...')); await sleep(2500); // find the modal root let modal=null; for (const m of document.querySelectorAll('*')) { const t=(m.innerText||''); if (t.indexOf('布线网络')>=0 && t.indexOf('忽略网络')>=0 && m.offsetParent!==null) { if (!modal || (m.innerText||'').length < (modal.innerText||'').length) modal=m; } } if(!modal) return {err:'no modal'}; // dump structure: elements with class names, around 布线图层 and 忽略网络 const dump = []; const walk = (el, d) => { if (d>14) return; const own = Array.from(el.childNodes).filter(n=>n.nodeType===3).map(n=>n.textContent.trim()).join('|'); const cls = (typeof el.className==='string'? el.className : ''); if (own || /checkbox|Checkbox|tree|Tree|select|Select|tag|Tag/.test(cls)) dump.push({d, tag: el.tagName, cls: cls.slice(0,70), txt: own.slice(0,40)}); for (const c of el.children) walk(c, d+1); }; walk(modal, 0); return {n: dump.length, dump: dump.slice(0, 120)};