import { listPages, wait } from '/home/admin9webs/shein建品/sh_lib.mjs'; import { CDP, SAN as S } from '/tmp/cdp3.mjs'; const t = (await listPages()).find(x=>/91miaoshou/i.test(x.url)); const c = await CDP.connect(t.webSocketDebuggerUrl); await c.send('Runtime.enable'); await wait(1200); console.log('点任务记录:', String(await c.evalJS(`(()=>{const b=[...document.querySelectorAll('button')].find(e=>/任务记录/.test(e.innerText||'')); if(!b) return 'nf'; for(const ev of ['mousedown','mouseup','click']) b.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 'clicked';})()`))); await wait(6000); const o = await c.evalJS(`(()=>{ const dlgs=[...document.querySelectorAll('.jx-dialog,.jx-drawer,[class*=dialog]')].filter(e=>e.offsetParent!==null); const rows=[...document.querySelectorAll('tr')].filter(e=>e.offsetParent!==null).map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim()).filter(Boolean).slice(0,5); return JSON.stringify({dlg:dlgs.length?dlgs[dlgs.length-1].innerText.replace(/\\s+/g,' ').trim().slice(0,400):'', rows});})()`); console.log('任务记录:', S(String(o)).slice(0,900)); process.exit(0);