This commit is contained in:
Matthias Hochmeister
2026-03-13 19:23:39 +01:00
parent 02d9d808b2
commit bc6d09200a
15 changed files with 610 additions and 74 deletions

View File

@@ -139,11 +139,30 @@ async function navigateToMemberList(page: Page): Promise<Frame> {
async function scrapeMembers(frame: Frame): Promise<FdiskMember[]> {
log(`Scraping member list from: ${frame.url()}`);
// If the page landed on a search form (not results yet), submit it
// Clear the Standesbuchnummer filter if the search form is present.
// FDISK pre-fills the logged-in user's own Standesbuchnummer, which limits results to 1 member.
// We clear it before submitting so all members of the fire station are returned.
const hasForm = await frame.$('form[name="frmsearch"]') !== null;
const hasTable = await frame.$('table.FdcLayList') !== null;
if (hasForm && !hasTable) {
log('Search form found without results — submitting...');
if (hasForm) {
const cleared = await frame.evaluate(() => {
const form = (document as any).forms['frmsearch'];
if (!form) return [];
const clearedFields: string[] = [];
for (const el of Array.from(form.elements) as HTMLInputElement[]) {
const name = (el.name ?? '').toLowerCase();
const id = (el.id ?? '').toLowerCase();
if (name.includes('standesbuch') || id.includes('standesbuch')) {
el.value = '';
clearedFields.push(el.name || el.id);
}
}
return clearedFields;
});
if (cleared.length > 0) {
log(`Cleared Standesbuchnummer filter fields: ${cleared.join(', ')}`);
} else {
log('Search form found — no Standesbuchnummer field detected, submitting as-is');
}
await frame.evaluate(() => { (document as any).forms['frmsearch'].submit(); });
await frame.waitForLoadState('networkidle');
log(`After form submit: ${frame.url()}`);