27 lines
1.3 KiB
JavaScript
27 lines
1.3 KiB
JavaScript
|
|
// 弹窗没打开——换点击方式:Playwright原生click + 多等待
|
||
|
|
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()));
|
||
|
|
// 原生点击卡片0的内容区
|
||
|
|
const card = p.locator('.recommend-item').first();
|
||
|
|
await card.scrollIntoViewIfNeeded().catch(() => { });
|
||
|
|
await card.locator('.resume-item__content, .talent-basic-info, div').first().click({ timeout: 8000 }).catch(async e => {
|
||
|
|
console.log('内容区点击失败,试卡片本身:', String(e).slice(0, 60));
|
||
|
|
await card.click({ timeout: 8000 }).catch(e2 => console.log('卡片点击也失败:', String(e2).slice(0, 60)));
|
||
|
|
});
|
||
|
|
await new Promise(r => setTimeout(r, 4000));
|
||
|
|
const st = await p.evaluate(() => {
|
||
|
|
const m = document.querySelector('.new-shortcut-resume__modal');
|
||
|
|
const anyModal = document.querySelector('.km-modal, [class*=resume-detail], [class*=modal][class*=open]');
|
||
|
|
return {
|
||
|
|
targetModal: !!m,
|
||
|
|
anyModal: !!anyModal,
|
||
|
|
anyModalCls: anyModal ? String(anyModal.className).slice(0, 60) : null,
|
||
|
|
url: location.href.slice(0, 100),
|
||
|
|
};
|
||
|
|
});
|
||
|
|
console.log('点击后:', JSON.stringify(st, null, 1));
|
||
|
|
process.exit(0);
|
||
|
|
})().catch(e => { console.log('ERR:', String(e).slice(0, 100)); process.exit(1); });
|