Files
claw-apply/lib/apply/ashby.mjs
Matthew Jackson fa6efc3775 Fix resume upload targeting wrong file input on Ashby
Prefer resume-specific file inputs (#resume, #_systemfield_resume)
over autofill inputs. Skip autofill class inputs in fallback.
Also fix Ashby beforeSubmit to target #_systemfield_resume directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:15:16 -08:00

31 lines
1.2 KiB
JavaScript

/**
* ashby.mjs — Ashby ATS handler (extends generic)
*/
import { apply as genericApply } from './generic.mjs';
export const SUPPORTED_TYPES = ['ashby'];
export async function apply(page, job, formFiller) {
return genericApply(page, job, formFiller, {
transformUrl: (url) => url.includes('/application') ? url : url.replace(/\/?(\?|$)/, '/application$1'),
closedTexts: ['job not found', 'the job you requested was not found'],
formDetector: '#_systemfield_name',
applyButtonSelector: 'button:has-text("Apply for this Job"), a:has-text("Apply for this Job")',
submitSelector: 'button:has-text("Submit Application")',
verifySelector: '#_systemfield_name',
beforeSubmit: async (page, formFiller) => {
if (!formFiller.profile.resume_path) return;
// #_systemfield_resume IS the file input (not a container)
const fileInput = await page.$('input[type="file"]#_systemfield_resume') ||
await page.$('input[type="file"]');
if (fileInput) {
const hasFile = await fileInput.evaluate(el => !!el.value);
if (!hasFile) {
await fileInput.setInputFiles(formFiller.profile.resume_path).catch(() => {});
await page.waitForTimeout(2000);
}
}
},
});
}