Source code for cadrumo.adapters.outbound.aeat.sede._browser_constants
"""Playwright browser wait-state constants and settings accessors for the sede adapter.Centralises the Playwright ``wait_until`` / ``wait_for_load_state`` stringliterals and the settings-backed viewport / probe-timeout accessors usedthroughout the sede adapter so they are defined once and verified by staticanalysis rather than duplicated across every navigation module."""from__future__importannotationsfromtypingimportTYPE_CHECKING,Final,Literalfrom.....core.configimportload_settingsifTYPE_CHECKING:fromplaywright.async_apiimportViewportSize#: Playwright wait state that resolves as soon as the HTML document has#: been parsed and the DOM is ready (no sub-resources awaited).PLAYWRIGHT_WAIT_DOMCONTENTLOADED:Final[Literal["domcontentloaded"]]="domcontentloaded"#: Playwright wait state that resolves once all pending network requests#: have completed or timed out (i.e., the network has gone idle).PLAYWRIGHT_WAIT_NETWORKIDLE:Final[Literal["networkidle"]]="networkidle"#: Short Playwright timeout (ms) used for non-critical ``wait_for_load_state`` probes#: inside retry loops where proceeding on timeout is the desired behaviour.PLAYWRIGHT_TIMEOUT_SHORT_MS:Final[int]=2_000
[docs]defdefault_viewport()->ViewportSize:"""Return the configured browser viewport size from settings."""settings=load_settings()return{"width":settings.cadrumo_browser_viewport_width,"height":settings.cadrumo_browser_viewport_height,}
[docs]defselector_probe_timeout_ms()->int:"""Return the configured selector-probe timeout (ms) from settings."""returnload_settings().cadrumo_browser_selector_probe_timeout_ms
[docs]defnavigation_timeout_ms()->int:"""Return the configured navigation timeout (ms) from settings."""returnload_settings().cadrumo_browser_navigation_timeout_ms