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 r = await c.evalJS(`(()=>{const box=[...document.querySelectorAll('.theme-select-box')].filter(e=>e.offsetParent!==null).pop(); if(!box)return'nf'; const chips=[...box.querySelectorAll('*')].filter(e=>e.offsetParent!==null&&/^\\s*尺寸\\(Size\\)\\s*$/.test((e.innerText||'').trim())); if(!chips.length)return'no-chip'; const el=chips[chips.length-1]; for(const ev of ['mousedown','mouseup','click']) el.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 'clicked';})()`); console.log('点尺寸:', String(r)); await wait(4000); const o = await c.evalJS(`(()=>{const p=document.querySelector('#app').__vue_app__.config.globalProperties.$pinia; const a=JSON.parse(JSON.stringify(p._s.get('sheinSkuAttrStore').$state)); const boxes=[...document.querySelectorAll('.sku-info-box')].filter(e=>e.offsetParent!==null).map((b,i)=>({ i, txt:(b.innerText||'').replace(/\\s+/g,' ').slice(0,90), opts:b.querySelectorAll('.sku-option').length, sels:[...b.querySelectorAll('.ant-select')].map(s=>(s.innerText||'').replace(/\\s+/g,' ').slice(0,16)), ins:[...b.querySelectorAll('input')].filter(i=>i.offsetParent!==null&&i.type!=='checkbox').map(i=>({ph:i.placeholder||'',cls:String(i.className||'').slice(0,40)})).slice(0,4)})); const btns=[...document.querySelectorAll('button')].filter(b=>b.offsetParent!==null&&/添加/.test(b.innerText||'')).map(b=>({t:(b.innerText||'').trim(),dis:b.disabled})); return JSON.stringify({attrs:(a.formState.skuAttrs||[]).map(x=>({n:x.name, opts:(x.options||[]).length})), boxes, btns},null,1);})()`); console.log(String(o).slice(0,1400)); process.exit(0);