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 p=propsOf(t); if(p&&typeof p.onClick==='function'){p.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; }; await eda.dmt_EditorControl.openDocument('7e9415a16a909c51'); await sleep(1500); const out = {}; for (const m of ['设计', '工具']) { const el = leaf(m); if (!el) { out[m] = 'menu not found'; continue; } fire(el); await sleep(800); // 菜单项通常在 role=menuitem 或者一个浮层里 const items = new Set(); for (const e of document.querySelectorAll('[role="menuitem"], li, .menu-item, [class*="menu"]')) { const t = (e.innerText || '').trim(); if (t && t.length < 30 && !t.includes('\n')) items.add(t); } out[m] = [...items]; // 关掉菜单 document.body.dispatchEvent(new MouseEvent('mousedown', {bubbles: true})); await sleep(400); } return out;