fix: scroll page before waiting for Easy Apply button; extend timeout to 12s

This commit is contained in:
2026-03-06 17:04:27 +00:00
parent 45ad5d1ec9
commit 318da35e01

View File

@@ -19,8 +19,9 @@ export async function apply(page, job, formFiller) {
// Navigate to job page
await page.goto(job.url, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT });
// Wait for Easy Apply button to appear (up to PAGE_LOAD_WAIT)
const eaBtn = await page.waitForSelector(LINKEDIN_APPLY_BUTTON_SELECTOR, { timeout: PAGE_LOAD_WAIT }).catch(() => null);
// Scroll slightly to trigger lazy-loaded content, then wait for Easy Apply button
await page.evaluate(() => window.scrollTo(0, 300)).catch(() => {});
const eaBtn = await page.waitForSelector(LINKEDIN_APPLY_BUTTON_SELECTOR, { timeout: 12000 }).catch(() => null);
if (!eaBtn) return { status: 'skipped_easy_apply_unsupported', meta };
// Re-read meta after page settled