From 0437b809a68440e8c47d9ce9987c6eac934cea3a Mon Sep 17 00:00:00 2001 From: bossgeekgo Date: Sat, 10 Feb 2024 10:56:29 +0800 Subject: [PATCH] add waitee for job list and position list; remove ka=header-job-recommend click --- main/index.mjs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main/index.mjs b/main/index.mjs index 3f1561b..13535e0 100644 --- a/main/index.mjs +++ b/main/index.mjs @@ -49,17 +49,17 @@ async function mainLoop () { page.goto(recommendJobPageUrl, { timeout: 0 }), page.waitForNavigation(), ]) - - await sleepWithRandomDelay(2500) - - const recommendJobLink = (await page.$('[ka=header-job-recommend]')) - await recommendJobLink.click() - const INIT_START_EXCEPT_JOB_INDEX = 0 let currentExceptJobIndex = INIT_START_EXCEPT_JOB_INDEX afterPageLoad: while (true) { + await sleepWithRandomDelay(2500) + + await Promise.all([ + page.waitForSelector('.job-recommend-main .recommend-search-expect .recommend-job-btn'), + page.waitForSelector('.job-list-container .rec-job-list') + ]) const currentActiveJobIndex = await page.evaluate(` - [...document.querySelectorAll('.job-recommend-search .recommend-job-btn')].findIndex(it => it.classList.contains('active')) + [...document.querySelectorAll('.job-recommend-main .recommend-search-expect .recommend-job-btn')].findIndex(it => it.classList.contains('active')) `) const expectJobList = await page.evaluate(`document.querySelector('.job-recommend-search')?.__vue__?.expectList`)