debug: log apply elements on skip; use state=attached for waitForSelector
This commit is contained in:
@@ -21,8 +21,16 @@ export async function apply(page, job, formFiller) {
|
||||
|
||||
// Scroll slightly to trigger lazy-loaded content, then wait for Easy Apply button
|
||||
await page.evaluate(() => window.scrollTo(0, 300)).catch(() => {});
|
||||
const eaBtn = await page.waitForSelector(LINKEDIN_APPLY_BUTTON_SELECTOR, { timeout: 12000 }).catch(() => null);
|
||||
if (!eaBtn) return { status: 'skipped_easy_apply_unsupported', meta };
|
||||
const eaBtn = await page.waitForSelector(LINKEDIN_APPLY_BUTTON_SELECTOR, { timeout: 12000, state: 'attached' }).catch(() => null);
|
||||
if (!eaBtn) {
|
||||
// Debug: log what apply-related elements exist
|
||||
const applyEls = await page.evaluate(() =>
|
||||
Array.from(document.querySelectorAll('[aria-label*="Easy Apply"], [aria-label*="Apply"]'))
|
||||
.map(el => ({ tag: el.tagName, aria: el.getAttribute('aria-label'), visible: el.offsetParent !== null }))
|
||||
).catch(() => []);
|
||||
console.log(` ℹ️ No Easy Apply element found. Apply-related elements: ${JSON.stringify(applyEls)}`);
|
||||
return { status: 'skipped_easy_apply_unsupported', meta };
|
||||
}
|
||||
|
||||
// Re-read meta after page settled
|
||||
const pageMeta = await page.evaluate(() => ({
|
||||
|
||||
Reference in New Issue
Block a user