ov.operate.perception#
Perception strategies – pluggable ways to turn a page into an Observation.
A perception strategy returns a uniform Observation so the rest
of the operate layer (and the host’s policy) stays declarative about what an
observation is, not how it was grounded. Three strategies ship:
ax_snapshot– affordances from an accessibility-relevant DOM walk plus the concise ARIA snapshot text (cheap, deterministic, the default).screenshot– the same affordances with bounding boxes, intended to pair with a screenshot artifact (for canvas/exotic renderers).hybrid– AX-grounded affordances, robust when the AX layer is thin.
Affordances are extracted by stamping a stable data-ov-ref attribute on each
interactive element, so act() can target it deterministically
(getByRole-stable, survives CSS churn) – the require-description-and-ref
safety pattern from Playwright-MCP.
Module Attributes
The attribute stamped on interactive elements to create stable refs. |
|
name -> |
Functions
|
Dispatch to the named perception strategy (defaults to |
|
Affordances + concise ARIA snapshot text (the cheap, deterministic default). |
|
AX-grounded affordances + ARIA snapshot; the robust default when AX is thin. |
|
Affordances with bounding boxes (pairs with a screenshot artifact). |
|
Decorator registering a perceiver under |
- ov.operate.perception.PERCEPTION_REGISTRY: dict[str, Callable[[Any], Observation]] = {'ax_snapshot': <function perceive_ax_snapshot>, 'hybrid': <function perceive_hybrid>, 'screenshot': <function perceive_screenshot>}#
name ->
perceiver(page) -> Observation
- ov.operate.perception.REF_ATTR = 'data-ov-ref'#
The attribute stamped on interactive elements to create stable refs.
- ov.operate.perception.perceive(page, strategy='ax_snapshot')[source]#
Dispatch to the named perception strategy (defaults to
ax_snapshot).Raises
KeyErrorwith the known strategies whenstrategyis unknown – an informative error per the project’s principles.- Return type:
- ov.operate.perception.perceive_ax_snapshot(page)[source]#
Affordances + concise ARIA snapshot text (the cheap, deterministic default).
- Return type:
- ov.operate.perception.perceive_hybrid(page)[source]#
AX-grounded affordances + ARIA snapshot; the robust default when AX is thin.
- Return type: