妙手:修正误判——提交一直有触发,失败因验证码读错(实测命中率约1/5);建议配 OCR 或人工登录
This commit is contained in:
1 parent
61daff1241
commit
3f60416e9c
3 files changed
+71
No files matched your search
@@ -248,3 +248,33 @@ await c.send('DOM.setFileInputFiles', { files: ['/path/ms_import.csv'], nodeId }
|
||||
去做 `导入产品` 那个触发点的验证(`/common_collect_box/items` → `导入产品` → 看是否列出 `ms2`)。
|
||||
若仍需我自动登录:下一步应改为**真实鼠标点 `.login-form__submit-btn`**(`Input.dispatchMouseEvent`),
|
||||
而不是 DOM `dispatchEvent`——这是本轮与前几轮唯一的行为差异。
|
||||
|
||||
## 第 7 轮:修正上一轮的误判 —— 提交其实**是**触发的,失败原因是验证码读错
|
||||
|
||||
只读诊断(没有再次尝试登录)看到:
|
||||
```
|
||||
按钮: {dis:false, txt:"立即登录"}
|
||||
输入: [{ph:"手机号/子账号/邮箱", val:"xia…"}, {ph:"密码", val:"Bin…"}, {ph:"请输入验证码", val:"…"}] ← 空
|
||||
```
|
||||
**关键**:账号和密码的值**还在**,**验证码框被清空了**。
|
||||
这是典型的「提交已发出并被拒 → 前端清空验证码并刷新图片」行为。
|
||||
所以上一轮我写的「提交疑似未触发」是**错的**:提交一直有触发,
|
||||
失败原因是**验证码读错**(错误提示是短暂 toast,我 12 秒后才查 DOM,已经消失)。
|
||||
|
||||
### 验证码识别的实测命中率(人眼读 base64 原图)
|
||||
| 次数 | 读数 | 结果 |
|
||||
|---|---|---|
|
||||
| 1 | `4821` | ❌ 读错 |
|
||||
| 2 | `0699` | ✅ 通过(唯一一次成功登录) |
|
||||
| 3 | `7317` | ❌ |
|
||||
| 4 | `0326` | ❌ |
|
||||
| 5 | `3620` | ❌ |
|
||||
|
||||
→ **约 1/5**。而登录页写着「再失败 9 次将锁定账号 1 个小时」,所以**不该继续靠人眼读码硬试**。
|
||||
|
||||
### 结论与建议
|
||||
- 要自动化妙手,**必须给验证码配 OCR/视觉能力**:
|
||||
本机 `modlens` 未配置视觉提供方(报 `No vision provider`);
|
||||
舰队技能里另有 `ddddocr` / `captcha-solving` 相关技能可先查。
|
||||
- 或者**人工在 VNC 登录一次**,agent 接手已登录会话(零风险、立刻可用)。
|
||||
- 登录后要立刻做的仍是那件事:`/common_collect_box/items` → 点 **`导入产品`** → 看是否列出 `ms2`。
|
||||
@@ -0,0 +1,14 @@
|
||||
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(1000);
|
||||
const o=await c.evalJS(`(()=>{
|
||||
const b=document.querySelector('.login-form__submit-btn');
|
||||
const ins=[...document.querySelectorAll('input')].filter(e=>e.offsetParent!==null).map(e=>({ph:e.placeholder||'',val:String(e.value||'').slice(0,3)+'…',dis:e.disabled,ro:e.readOnly}));
|
||||
const txt=(document.body.innerText||'').replace(/\\s+/g,' ');
|
||||
const hints=txt.match(/.{0,16}(锁定|失败|次数|验证|禁用).{0,22}/g);
|
||||
return JSON.stringify({btn: b?{dis:b.disabled, cls:String(b.className).slice(0,60), txt:(b.innerText||'').trim()}:null,
|
||||
ins, hints:(hints||[]).slice(0,6), href:location.href});})()`);
|
||||
console.log('诊断:', S(String(o)).slice(0,900));
|
||||
process.exit(0);
|
||||
@@ -0,0 +1,27 @@
|
||||
import { listPages, wait } from '/home/admin9webs/shein建品/sh_lib.mjs';
|
||||
import { CDP, SAN as S } from '/tmp/cdp3.mjs';
|
||||
import { readFileSync } from 'fs';
|
||||
const doc=readFileSync('/home/admin9webs/agent-a2-import/skills/ecommerce/miaoshou-erp/SKILL.md','utf8');
|
||||
const acc=(doc.match(/xiaochaoren\d+/)||[])[0], pwd=(doc.match(/Bingo\d+@/)||[])[0];
|
||||
const CAP=process.argv[2];
|
||||
const t=(await listPages()).find(x=>/91miaoshou/i.test(x.url));
|
||||
const c=await CDP.connect(t.webSocketDebuggerUrl);
|
||||
await c.send('Page.enable'); await c.send('Runtime.enable'); await wait(800);
|
||||
// 1) 填表
|
||||
console.log('填表:', S(String(await c.evalJS(`(()=>{const set=(sel,v)=>{const el=document.querySelector(sel); if(!el) return 0;
|
||||
const s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,'value').set; s.call(el,v);
|
||||
el.dispatchEvent(new Event('input',{bubbles:true})); el.dispatchEvent(new Event('change',{bubbles:true})); return 1;};
|
||||
const r={a:set('input.login-form__input[placeholder="手机号/子账号/邮箱"]', ${JSON.stringify(acc)}),
|
||||
p:set('input.login-form__input[type=password]', ${JSON.stringify(pwd)}), k:set('.captcha-field__input', ${JSON.stringify(CAP)})};
|
||||
const b=document.querySelector('.login-form__submit-btn');
|
||||
if(b){const rr=b.getBoundingClientRect(); r.btn=[Math.round(rr.x+rr.width/2),Math.round(rr.y+rr.height/2)];}
|
||||
return JSON.stringify(r);})()`))).slice(0,180));
|
||||
// 2) 取按钮坐标 → 真实鼠标点击
|
||||
const pos=JSON.parse(String(await c.evalJS(`(()=>{const b=document.querySelector('.login-form__submit-btn'); if(!b) return '[]';
|
||||
const r=b.getBoundingClientRect(); return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`)));
|
||||
console.log('按钮坐标:', JSON.stringify(pos));
|
||||
await c.send('Input.dispatchMouseEvent',{type:'mouseMoved',x:pos[0],y:pos[1],buttons:0}); await wait(300);
|
||||
for(const tp of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type:tp,x:pos[0],y:pos[1],button:'left',clickCount:1,buttons:1});
|
||||
await wait(12000);
|
||||
console.log('登录:', S(String(await c.evalJS(`JSON.stringify({href:location.href, login:!!document.querySelector('input[type=password]'), err:[...document.querySelectorAll('*')].filter(e=>e.children.length===0&&/不正确|错误|锁定/.test(e.innerText||'')).map(e=>e.innerText.trim()).slice(0,2)})`))).slice(0,220));
|
||||
process.exit(0);
|
||||
Reference in new issue
Block a user