skip hidden and disabled controls

This commit is contained in:
Jan Bader
2026-04-07 23:18:51 +02:00
parent 6e29103f5f
commit 2f7ada655e

View File

@@ -201,6 +201,11 @@ def fill_invoice_fields(page: Page) -> None:
for selector in selectors: for selector in selectors:
el = page.locator(selector).first el = page.locator(selector).first
if el.count() > 0: if el.count() > 0:
input_type = (el.get_attribute("type") or "").lower()
if input_type == "hidden":
continue
if not el.is_visible() or not el.is_enabled():
continue
tag = el.evaluate("el => el.tagName.toLowerCase()") tag = el.evaluate("el => el.tagName.toLowerCase()")
if tag == "select": if tag == "select":
el.select_option(label=value) el.select_option(label=value)