Files
claw-apply/lib/apply/ashby.mjs
Matthew Jackson a17886e58b Fix Ashby resume upload and add validation error logging
Ashby wraps file input inside #_systemfield_resume container — search
for the actual input[type="file"] element. Also capture and log
validation errors from the page when submit returns incomplete.

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

28 lines
1.1 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'),
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;
// Ashby wraps resume upload in a custom component — find the actual file input
const fileInput = await page.$('#_systemfield_resume input[type="file"]') ||
await page.$('input[type="file"][name*="resume"]') ||
await page.$('input[type="file"]');
if (fileInput) {
await fileInput.setInputFiles(formFiller.profile.resume_path).catch(() => {});
await page.waitForTimeout(1500);
}
},
});
}