fix(sync): use ViewState extraction for Untersuchungen pagination instead of form submit
This commit is contained in:
@@ -979,15 +979,23 @@ async function scrapeMemberUntersuchungen(
|
||||
return [];
|
||||
}
|
||||
|
||||
// Show all rows: select "ALLE", then explicitly submit the form so ASP.NET
|
||||
// processes the request with its server-generated ViewState.
|
||||
await selectAlleAnzeige(frame);
|
||||
const submitBtn = frame.locator('input[type="image"][src*="suchen"]');
|
||||
if (await submitBtn.count() > 0) {
|
||||
await Promise.all([
|
||||
frame.waitForNavigation({ waitUntil: 'networkidle', timeout: 15000 }).catch(() => {}),
|
||||
submitBtn.click(),
|
||||
]);
|
||||
// ASP.NET needs ViewState to properly process anzeige_count.
|
||||
// Extract it from the loaded page and re-navigate with all params + ALLE.
|
||||
const formState = await frame.evaluate(() => {
|
||||
const vs = (document.getElementById('__VIEWSTATE') as HTMLInputElement)?.value ?? '';
|
||||
const vsg = (document.getElementById('__VIEWSTATEGENERATOR') as HTMLInputElement)?.value ?? '';
|
||||
return { vs, vsg };
|
||||
}).catch(() => ({ vs: '', vsg: '' }));
|
||||
|
||||
if (formState.vs) {
|
||||
const alleUrl = `${BASE_URL}/fdisk/module/mgvw/untersuchungen/UntersuchungenList.aspx`
|
||||
+ `?__VIEWSTATE=${encodeURIComponent(formState.vs)}`
|
||||
+ `&__VIEWSTATEGENERATOR=${encodeURIComponent(formState.vsg)}`
|
||||
+ `&searchdatum=&searchanmerkungen=&searchid_untersuchungsarten=`
|
||||
+ `&searchid_personen=${idPersonen}&searchid_mitgliedschaften=${idMitgliedschaft}`
|
||||
+ `&id_personen=${idPersonen}&id_mitgliedschaften=${idMitgliedschaft}`
|
||||
+ `&anzeige_count=ALLE&offset=0&ordnung=2&orderType=ASC&search=1`;
|
||||
await frame_goto(frame, alleUrl);
|
||||
}
|
||||
|
||||
// Try to navigate to history/detail view if available
|
||||
|
||||
Reference in New Issue
Block a user