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>
This commit is contained in:
@@ -154,19 +154,29 @@ async function fillAndSubmit(page, job, formFiller, meta, opts) {
|
||||
const verifySelector = opts.verifySelector || 'form button[type="submit"]:not([disabled])';
|
||||
const postSubmit = await page.evaluate((vs) => {
|
||||
const text = (document.body.innerText || '').toLowerCase();
|
||||
// Check for validation errors (red text, error messages)
|
||||
const errorEls = document.querySelectorAll('[class*="error"], [class*="invalid"], [role="alert"]');
|
||||
const validationErrors = Array.from(errorEls)
|
||||
.map(el => el.innerText?.trim())
|
||||
.filter(t => t && t.length < 200)
|
||||
.slice(0, 3);
|
||||
return {
|
||||
hasSuccess: text.includes('application submitted') || text.includes('successfully applied') ||
|
||||
text.includes('thank you') || text.includes('application received') ||
|
||||
text.includes('application has been') || text.includes('we received your'),
|
||||
hasForm: !!document.querySelector(vs),
|
||||
validationErrors,
|
||||
};
|
||||
}, verifySelector).catch(() => ({ hasSuccess: false, hasForm: false }));
|
||||
}, verifySelector).catch(() => ({ hasSuccess: false, hasForm: false, validationErrors: [] }));
|
||||
|
||||
if (postSubmit.hasSuccess || !postSubmit.hasForm) {
|
||||
return { status: 'submitted', meta };
|
||||
}
|
||||
|
||||
return { status: 'incomplete', meta };
|
||||
return {
|
||||
status: 'incomplete', meta,
|
||||
...(postSubmit.validationErrors?.length && { validation_errors: postSubmit.validationErrors }),
|
||||
};
|
||||
}
|
||||
|
||||
// Multi-step: Next/Continue
|
||||
|
||||
Reference in New Issue
Block a user