update
This commit is contained in:
@@ -905,11 +905,21 @@ async function scrapeMemberFahrgenehmigungen(
|
||||
const pageData = await frame.evaluate(() => {
|
||||
const extractCellValue = (cell: Element): string => {
|
||||
const input = cell.querySelector('input[type="text"], input:not([type])') as HTMLInputElement | null;
|
||||
if (input) return input.value?.trim() ?? '';
|
||||
if (input && input.value?.trim()) return input.value.trim();
|
||||
const sel = cell.querySelector('select') as HTMLSelectElement | null;
|
||||
if (sel) {
|
||||
const opt = sel.options[sel.selectedIndex];
|
||||
return (opt?.text || opt?.value || '').trim();
|
||||
const idx = sel.selectedIndex;
|
||||
if (idx >= 0 && sel.options[idx]) {
|
||||
const t = (sel.options[idx].text || sel.options[idx].value || '').trim();
|
||||
if (t) return t;
|
||||
}
|
||||
if (sel.value?.trim()) return sel.value.trim();
|
||||
const selectedOpt = sel.querySelector('option[selected]') as HTMLOptionElement | null;
|
||||
if (selectedOpt) {
|
||||
const t = (selectedOpt.text || selectedOpt.value || '').trim();
|
||||
if (t) return t;
|
||||
}
|
||||
// fall through to textContent if select is empty
|
||||
}
|
||||
const anchor = cell.querySelector('a');
|
||||
const atitle = anchor?.getAttribute('title')?.trim();
|
||||
|
||||
Reference in New Issue
Block a user