debug: full-page button scan, modal heading, real progress, validation errors; bump max steps to 20

This commit is contained in:
2026-03-06 17:43:03 +00:00
parent b79e9d0b9c
commit 33c50178f4
2 changed files with 13 additions and 8 deletions

View File

@@ -57,17 +57,22 @@ export async function apply(page, job, formFiller) {
el => el.getAttribute('aria-valuenow') || el.getAttribute('value') || String(el.style?.width || step)
).catch(() => String(step));
// Snapshot all buttons visible in modal for debugging
const modalButtons = await page.evaluate((sel) => {
// Snapshot modal heading + all page-level buttons for debugging
const debugInfo = await page.evaluate((sel) => {
const modal = document.querySelector(sel);
if (!modal) return [];
return Array.from(modal.querySelectorAll('button, [role="button"]')).map(b => ({
const heading = modal?.querySelector('h1, h2, h3, [class*="title"], [class*="heading"]')?.textContent?.trim()?.slice(0, 60) || '';
const realProgress = document.querySelector('[role="progressbar"]')?.getAttribute('aria-valuenow') ||
document.querySelector('[role="progressbar"]')?.getAttribute('aria-valuetext') || null;
const allBtns = Array.from(document.querySelectorAll('button')).map(b => ({
text: b.textContent?.trim().slice(0, 40),
aria: b.getAttribute('aria-label'),
disabled: b.disabled,
})).filter(b => b.text || b.aria);
}, LINKEDIN_EASY_APPLY_MODAL_SELECTOR).catch(() => []);
console.log(` [step ${step}] progress=${progress} buttons=${JSON.stringify(modalButtons)}`);
})).filter(b => (b.text || b.aria) && !['Home', 'Jobs', 'Me', 'For Business', 'Save the job'].includes(b.aria));
const errors = Array.from(document.querySelectorAll('[class*="error"], [aria-invalid="true"], .artdeco-inline-feedback--error'))
.map(e => e.textContent?.trim().slice(0, 60)).filter(Boolean);
return { heading, realProgress, allBtns, errors };
}, LINKEDIN_EASY_APPLY_MODAL_SELECTOR).catch(() => ({}));
console.log(` [step ${step}] heading="${debugInfo.heading}" realProgress=${debugInfo.realProgress} buttons=${JSON.stringify(debugInfo.allBtns)} errors=${JSON.stringify(debugInfo.errors)}`);
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))}`);

View File

@@ -29,7 +29,7 @@ export const LINKEDIN_SUBMIT_SELECTOR = 'button[aria-label="Submit application"]
export const LINKEDIN_NEXT_SELECTOR = 'button[aria-label="Continue to next step"]';
export const LINKEDIN_REVIEW_SELECTOR = 'button[aria-label="Review your application"]';
export const LINKEDIN_DISMISS_SELECTOR = 'button[aria-label="Dismiss"]';
export const LINKEDIN_MAX_MODAL_STEPS = 12;
export const LINKEDIN_MAX_MODAL_STEPS = 20;
// --- Wellfound ---
export const WELLFOUND_BASE = 'https://wellfound.com';