Use networkidle for job page navigation to fix intermittent button miss

domcontentloaded fires before JS renders the Easy Apply button,
causing flaky "No Easy Apply button found" failures on valid listings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 12:28:50 -08:00
parent c5ebdc9362
commit 7a730f689e

View File

@@ -131,8 +131,8 @@ async function findApplyModal(page) {
export async function apply(page, job, formFiller) {
const meta = { title: job.title, company: job.company };
// Navigate to job page
await page.goto(job.url, { waitUntil: 'domcontentloaded', timeout: NAVIGATION_TIMEOUT });
// Navigate to job page — networkidle ensures JS has rendered the Easy Apply button
await page.goto(job.url, { waitUntil: 'networkidle', timeout: NAVIGATION_TIMEOUT });
// Scroll slightly to trigger lazy-loaded content, then wait for Easy Apply button
await page.evaluate(() => window.scrollTo(0, 300)).catch(() => {});