Improve generic applier: better closed/404 detection and submit selectors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,7 +42,11 @@ export async function apply(page, job, formFiller) {
|
||||
const hasCaptcha = hasVisibleCaptcha;
|
||||
const isClosed = text.includes('no longer accepting') || text.includes('position has been filled') ||
|
||||
text.includes('this job is no longer') || text.includes('job not found') ||
|
||||
text.includes('this position is closed') || text.includes('listing has expired');
|
||||
text.includes('this position is closed') || text.includes('listing has expired') ||
|
||||
text.includes('no longer available') || text.includes('page you are looking for') ||
|
||||
text.includes('job may be no longer') || text.includes('does not exist') ||
|
||||
text.includes('this role has been filled') || text.includes('posting has closed') ||
|
||||
document.title.toLowerCase().includes('404');
|
||||
return { hasLogin, hasCaptcha, isClosed };
|
||||
}).catch(() => ({}));
|
||||
|
||||
@@ -102,12 +106,14 @@ async function applyOnPage(page, job, formFiller, meta) {
|
||||
if (unknowns[0]?.honeypot) return { status: 'skipped_honeypot', meta };
|
||||
if (unknowns.length > 0) return { status: 'needs_answer', pending_question: unknowns[0], meta };
|
||||
|
||||
// Look for submit button
|
||||
// Look for submit button — try specific text first, then generic type="submit"
|
||||
const submitBtn = await page.$([
|
||||
'button[type="submit"]:not([disabled])',
|
||||
'input[type="submit"]:not([disabled])',
|
||||
'button:has-text("Submit Application")',
|
||||
'button:has-text("Submit")',
|
||||
'button:has-text("Submit your application")',
|
||||
'button:has-text("Apply Now")',
|
||||
'button:has-text("Apply for this job")',
|
||||
'input[type="submit"]:not([disabled])',
|
||||
'button[type="submit"]:not([disabled])',
|
||||
].join(', '));
|
||||
|
||||
// Look for Next/Continue button (multi-step forms)
|
||||
|
||||
Reference in New Issue
Block a user