v10.12 修复hr1打招呼失败: 开弹窗改Playwright原生点击(合成click被平台反自动化检测拦截返回空壳弹窗); 新增空壳弹窗识别+重试+跳过逻辑
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// 诊断:列出hr1 Chrome的所有标签页和当前推荐页真实状态
|
||||
const pw = require('playwright-core');
|
||||
(async () => {
|
||||
const b = await pw.chromium.connectOverCDP('http://127.0.0.1:9223');
|
||||
const pages = b.contexts()[0].pages();
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
try {
|
||||
const url = pages[i].url();
|
||||
const title = await pages[i].title().catch(() => '');
|
||||
console.log(`tab${i} | ${url.slice(0, 85)} | ${String(title).slice(0, 25)}`);
|
||||
} catch (e) { console.log(`tab${i} | (无法读取)`); }
|
||||
}
|
||||
// 找推荐页再深度看一次(可能用户手动操作后URL已变)
|
||||
const p = pages.find(x => /rd\d?\.zhaopin\.com\/app\/recommend/.test(x.url()));
|
||||
if (p) {
|
||||
const r = await p.evaluate(() => {
|
||||
const body = document.body.innerText || '';
|
||||
const modal = document.querySelector('.new-shortcut-resume__modal');
|
||||
return {
|
||||
url: location.href.slice(0, 90),
|
||||
jobOff: body.includes('未上线'),
|
||||
chat: document.querySelector('.rights-chat-count .rights-count-number')?.innerText || null,
|
||||
modalOpen: !!modal,
|
||||
greetBtn: modal ? (modal.querySelector('button.km-button--primary.km-button--filled')?.innerText || '(无主按钮)') : null,
|
||||
};
|
||||
}).catch(e => ({ err: String(e).slice(0, 60) }));
|
||||
console.log('推荐页:', JSON.stringify(r, null, 1));
|
||||
}
|
||||
process.exit(0);
|
||||
})().catch(e => { console.log('ERR:', String(e).slice(0, 100)); process.exit(1); });
|
||||
Reference in New Issue
Block a user