Joom 47 条进待发布:jmbatch 跑通(店铺复选框组/可搜索类目/smtChoice* store),新增 3 条坑(无星号必填、虚拟滚动下拉、哨兵串定位 store)与 4 平台侦察表
This commit is contained in:
1 parent
c69952bd59
commit
c275571317
17 files changed
+1156
-4
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { newPage, closePage, wait } from '/home/admin9webs/shein建品/sh_lib.mjs';
|
||||
import { SAN as S } from '/tmp/cdp3.mjs';
|
||||
const P = `document.querySelector('#app').__vue_app__.config.globalProperties.$pinia`;
|
||||
const c = await newPage('https://www.dianxiaomi.com/web/joomProduct/add');
|
||||
await wait(12000);
|
||||
// 1) 店铺选择控件长什么样
|
||||
const shop = await c.evalJS(`(()=>{
|
||||
const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null).find(e=>/店铺名称/.test((e.querySelector('label')||{}).innerText||''));
|
||||
if(!it) return 'no-item';
|
||||
const ctrls=[...it.querySelectorAll('.ant-select,.ant-checkbox-group,.ant-radio-group')].map(x=>x.tagName+'.'+String(x.className).slice(0,40));
|
||||
const txt=(it.innerText||'').replace(/\\s+/g,' ').trim().slice(0,120);
|
||||
return JSON.stringify({ctrls, txt, html:it.innerHTML.replace(/\\s+/g,' ').slice(0,500)});})()`);
|
||||
console.log('店铺:', S(String(shop)).slice(0,900));
|
||||
// 2) 点开它
|
||||
const pos = JSON.parse(String(await c.evalJS(`(()=>{const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null).find(e=>/店铺名称/.test((e.querySelector('label')||{}).innerText||''));
|
||||
const s=it?it.querySelector('.ant-select-selector'):null; if(!s) return '[]'; s.scrollIntoView({block:'center'});
|
||||
const r=s.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){
|
||||
await c.send('Input.dispatchMouseEvent',{type:'mouseMoved',x:pos[0],y:pos[1],buttons:0}); await wait(300);
|
||||
for(const t of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type:t,x:pos[0],y:pos[1],button:'left',clickCount:1,buttons:1});
|
||||
await wait(2500);
|
||||
}
|
||||
const opts = await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop();
|
||||
if(!dd) return 'no-dd';
|
||||
const items=[...dd.querySelectorAll('.ant-select-item-option')].map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim());
|
||||
const multi=!!dd.querySelector('.ant-select-item-option-selected, .ant-checkbox');
|
||||
return JSON.stringify({n:items.length, items:items.slice(0,12), multi});})()`);
|
||||
console.log('店铺选项:', S(String(opts)).slice(0,800));
|
||||
try{ await c.shot('/tmp/joom_shop.jpg'); console.log('shot ok'); }catch(e){}
|
||||
await closePage(c); process.exit(0);
|
||||
Reference in new issue
Block a user