v10.12 修复hr1打招呼失败: 开弹窗改Playwright原生点击(合成click被平台反自动化检测拦截返回空壳弹窗); 新增空壳弹窗识别+重试+跳过逻辑
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// 弹窗DOM存在但innerText为空且不可见——可能是懒渲染。等待内容加载再抓,同时截图直看
|
||||
const pw = require('playwright-core');
|
||||
(async () => {
|
||||
const b = await pw.chromium.connectOverCDP('http://127.0.0.1:9223');
|
||||
const p = b.contexts()[0].pages().find(x => /recommend/.test(x.url()));
|
||||
// 重新点击卡片并等足8秒
|
||||
await p.evaluate(() => document.querySelector('.recommend-item .resume-item__content, .recommend-item')?.click()).catch(() => { });
|
||||
await new Promise(r => setTimeout(r, 8000));
|
||||
const st = await p.evaluate(() => {
|
||||
const m = document.querySelector('.new-shortcut-resume__modal');
|
||||
const km = document.querySelector('.km-modal--open, .km-modal:not([style*="display: none"])');
|
||||
return {
|
||||
resumeModal: !!m,
|
||||
resumeModalText: m ? (m.innerText || '').replace(/\n/g, '|').slice(0, 200) : null,
|
||||
kmOpen: !!km,
|
||||
kmText: km ? (km.innerText || '(空文本)').replace(/\n/g, '|').slice(0, 200) : null,
|
||||
};
|
||||
}).catch(e => ({ err: String(e).slice(0, 60) }));
|
||||
console.log(JSON.stringify(st, null, 1));
|
||||
// 截图(整页)直看页面到底是什么状态
|
||||
await p.screenshot({ path: '/opt/data/logs/recruitment/hr1-page-now.png' }).catch(e => console.log('截图失败', String(e).slice(0, 50)));
|
||||
console.log('截图已存: hr1-page-now.png');
|
||||
process.exit(0);
|
||||
})().catch(e => { console.log('ERR:', String(e).slice(0, 100)); process.exit(1); });
|
||||
Reference in New Issue
Block a user