v10.10 打招呼点击修复: 合成click改Playwright原生locator点击(部分弹窗不响应合成点击), 固定2.5s等待改8s轮询+重试1次——今晨hr1连续3次失败熔断的根因
This commit is contained in:
+19
-10
@@ -145,16 +145,25 @@ async function closeModal(page) {
|
||||
|
||||
// 弹窗内打招呼(v9:天然绑定正确的人,杜绝列表 index 错位)
|
||||
async function clickGreetInModal(page) {
|
||||
return page.evaluate(async () => {
|
||||
const btn = document.querySelector('.new-shortcut-resume__modal button.km-button--primary.km-button--filled');
|
||||
if (!btn) return false;
|
||||
const t = btn.innerText.trim();
|
||||
if (t === '继续沟通') return true; // 已打过
|
||||
if (!t.includes('打招呼')) return false;
|
||||
btn.click();
|
||||
await new Promise(r => setTimeout(r, 2500));
|
||||
return btn.innerText.trim() === '继续沟通';
|
||||
});
|
||||
// v10.10(2026-09-02):原生 locator 点击(合成 click 对部分弹窗无效)
|
||||
// + 轮询等待按钮变化(最长8秒,替代固定2.5秒)+ 失败重试1次
|
||||
for (let attempt = 0; attempt < 2; attempt++) {
|
||||
try {
|
||||
const btn = page.locator('.new-shortcut-resume__modal button.km-button--primary.km-button--filled').first();
|
||||
const t = (await btn.innerText({ timeout: 5000 }).catch(() => '')).trim();
|
||||
if (t === '继续沟通') return true; // 已打过
|
||||
if (!t.includes('打招呼')) return false;
|
||||
await btn.click({ timeout: 5000 });
|
||||
// 轮询等按钮变"继续沟通"(最长8秒)
|
||||
for (let i = 0; i < 16; i++) {
|
||||
await new Promise(r => setTimeout(r, 500));
|
||||
const t2 = (await btn.innerText({ timeout: 2000 }).catch(() => '')).trim();
|
||||
if (t2 === '继续沟通') return true;
|
||||
}
|
||||
// 8秒没变——重试一次(第二次 attempt)
|
||||
} catch (_) { /* 进重试 */ }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 人类行为模拟:弹窗内容超一屏时随机滚动
|
||||
|
||||
Reference in New Issue
Block a user