Dismiss LinkedIn education/experience sub-forms before filling

LinkedIn sometimes opens an Add Education/Experience sub-form with
Save/Cancel buttons that blocks the main Next button. Detect and
cancel these before attempting to fill the step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 14:54:40 -08:00
parent ad281d1a9f
commit 029360b118

View File

@@ -189,6 +189,16 @@ export async function apply(page, job, formFiller) {
const debugInfo = await getModalDebugInfo(page, MODAL);
console.log(` [step ${step}] progress=${progress} heading="${debugInfo.heading}" buttons=${JSON.stringify(debugInfo.buttons)}${debugInfo.errors.length ? ' errors=' + JSON.stringify(debugInfo.errors) : ''}`);
// LinkedIn sometimes opens an "Add education/experience" sub-form with Save/Cancel buttons.
// These block the main Next button. Dismiss them before filling.
const saveBtn = await findModalButton(page, MODAL, { ariaLabels: [], exactTexts: ['Save'] });
const cancelBtn = await findModalButton(page, MODAL, { ariaLabels: [], exactTexts: ['Cancel'] });
if (saveBtn && cancelBtn) {
console.log(` [step ${step}] sub-form detected (Save/Cancel) — cancelling`);
await cancelBtn.click({ timeout: APPLY_CLICK_TIMEOUT }).catch(() => {});
await page.waitForTimeout(CLICK_WAIT);
}
// Fill form fields — page.$() in form_filler pierces shadow DOM
const unknowns = await formFiller.fill(page, formFiller.profile.resume_path);
if (unknowns.length > 0) console.log(` [step ${step}] unknown fields: ${JSON.stringify(unknowns.map(u => u.label || u))}`);