import { attach } from '/tmp/cdp3.mjs'; const wait = ms => new Promise(z => setTimeout(z, ms)); const c = await attach('/web/sheinProduct/add') || await attach('dianxiaomi.com'); const pos = JSON.parse(String(await c.evalJS(`(()=>{const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null) .find(x=>{const l=x.querySelector('label'); return l&&/尺码表/.test(l.innerText||'');}); if(!it)return'[]'; const el=it.querySelector('.link')||it.querySelector('a,span'); if(!el)return'[]'; el.scrollIntoView({block:'center'}); const r=el.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 type of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type,x:pos[0],y:pos[1],button:'left',clickCount:1}); } await wait(6000); const o = await c.evalJS(`(()=>{ const ms=[...document.querySelectorAll('.ant-modal')].filter(e=>e.offsetParent!==null).map(m=>({t:(m.querySelector('.ant-modal-title')||{}).innerText||'', inputs:[...m.querySelectorAll('input')].map(i=>i.placeholder||i.type).slice(0,8), btns:[...m.querySelectorAll('button')].map(b=>(b.innerText||'').trim()).slice(0,8), txt:(m.innerText||'').replace(/\\s+/g,' ').slice(0,320)})); const p=document.querySelector('#app').__vue_app__.config.globalProperties.$pinia; let sz=null; try{ sz=JSON.stringify(p._s.get('sheinSkuAttrStore').$state.formState.sizeTableInfo).slice(0,200);}catch(e){} return JSON.stringify({modals:ms, sizeTableInfo:sz},null,1);})()`); console.log(String(o).slice(0,1400)); process.exit(0);