Decouple form filler from LinkedIn modal selector

Form filler now defaults to page root instead of scoping to
[role="dialog"]. LinkedIn Easy Apply passes its modal selector
explicitly. Fixes external ATS forms being scoped to wrong
container. Also improved Greenhouse handler with targeted
resume upload and form detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 20:58:51 -08:00
parent a17886e58b
commit f586c6d091
3 changed files with 21 additions and 5 deletions

View File

@@ -212,7 +212,7 @@ export async function apply(page, job, formFiller) {
}
// Fill form fields — page.$() in form_filler pierces shadow DOM
const unknowns = await formFiller.fill(page, formFiller.profile.resume_path);
const unknowns = await formFiller.fill(page, formFiller.profile.resume_path, { modalSelector: MODAL });
if (unknowns.length > 0) console.log(` [step ${step}] unknown fields: ${JSON.stringify(unknowns.map(u => u.label || u))}`);
if (unknowns[0]?.honeypot) {

View File

@@ -1,5 +1,8 @@
/**
* greenhouse.mjs — Greenhouse ATS handler (extends generic)
*
* Greenhouse boards show the form directly on the page (no Apply button needed).
* Form ID: #application-form. Resume input: #resume. Submit: "Submit application".
*/
import { apply as genericApply } from './generic.mjs';
@@ -7,6 +10,19 @@ export const SUPPORTED_TYPES = ['greenhouse'];
export async function apply(page, job, formFiller) {
return genericApply(page, job, formFiller, {
submitSelector: 'button:has-text("Submit Application"), input[type="submit"]',
formDetector: '#application-form',
submitSelector: 'button:has-text("Submit application"), input[type="submit"]',
verifySelector: '#application-form',
beforeSubmit: async (page, formFiller) => {
if (!formFiller.profile.resume_path) return;
const resumeInput = await page.$('#resume');
if (resumeInput) {
const hasFile = await resumeInput.evaluate(el => !!el.value);
if (!hasFile) {
await resumeInput.setInputFiles(formFiller.profile.resume_path).catch(() => {});
await page.waitForTimeout(1000);
}
}
},
});
}