import { attach } from '/tmp/cdp3.mjs'; const wait = ms => new Promise(z => setTimeout(z, ms)); const c = await attach('/web/temu/add') || await attach('dianxiaomi.com'); await c.evalJS(`document.body.click()`); await wait(600); const pos = JSON.parse(String(await c.evalJS(`(()=>{ const boxes=[...document.querySelectorAll('*')].filter(e=>e.offsetParent!==null&&/颜色/.test(e.innerText||'')&&e.querySelector('input[type=search]')&&e.querySelectorAll('*').length<300); const box=boxes[boxes.length-1]; if(!box)return'[]'; const s=box.closest('.ant-select')||box.querySelector('.ant-select')||box; const sel=s.querySelector('.ant-select-selector')||s; sel.scrollIntoView({block:'center'}); const r=sel.getBoundingClientRect(); return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`))); console.log('坐标:', JSON.stringify(pos)); if(pos.length){ for(const t of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type:t,x:pos[0],y:pos[1],button:'left',clickCount:1}); } await wait(3000); const o = await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop(); if(!dd)return'no-dd'; const opts=[...dd.querySelectorAll('.ant-select-item-option')].map(e=>(e.innerText||'').trim()); return JSON.stringify({n:opts.length, first:opts.slice(0,10), txt:(dd.innerText||'').replace(/\\s+/g,' ').slice(0,180)});})()`); console.log('下拉:', String(o).slice(0,600)); process.exit(0);