From 46c84bf28a766a4a35dbad6e8283ef0f054861b0 Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Fri, 6 Mar 2026 10:57:35 -0800 Subject: [PATCH] fix: click parent link for Continue, not child Co-Authored-By: Claude Opus 4.6 --- lib/apply/easy_apply.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/apply/easy_apply.mjs b/lib/apply/easy_apply.mjs index 1ee42f4..8ac3b77 100644 --- a/lib/apply/easy_apply.mjs +++ b/lib/apply/easy_apply.mjs @@ -114,15 +114,15 @@ export async function apply(page, job, formFiller) { await page.evaluate(() => window.scrollTo(0, 300)).catch(() => {}); let eaBtn = await page.waitForSelector(LINKEDIN_APPLY_BUTTON_SELECTOR, { timeout: 12000, state: 'attached' }).catch(() => null); - // Fallback: LinkedIn shows plain "Continue" when a draft exists (not a button — a span) - // Look for it via the apply URL pattern in the page + // Fallback: LinkedIn shows plain "Continue" when a draft exists (span inside an ) + // Find the parent link and click that, or navigate to the apply URL if (!eaBtn) { - const continueEl = await page.$(`a[href*="/apply/"] span, [class*="apply"] span`); - if (continueEl) { - const text = await continueEl.evaluate(el => (el.innerText || '').trim()).catch(() => ''); - if (text === 'Continue') { - eaBtn = continueEl; - console.log(` ℹ️ Found "Continue" element (draft application)`); + const applyLink = await page.$(`a[href*="/apply/"]`); + if (applyLink) { + const text = await applyLink.evaluate(el => (el.innerText || '').trim()).catch(() => ''); + if (/continue/i.test(text)) { + eaBtn = applyLink; + console.log(` ℹ️ Found "Continue" link (draft application)`); } } }