Plushie.Automation.Element (Plushie v0.6.0)

Copy Markdown View Source

Represents a widget element found in the UI tree during automation.

Created by find/2 and used for scoped assertions, automation flows, and runtime inspection. Contains the widget's ID, type, props, and children.

Summary

Functions

Returns the a11y props map from the element, or nil if not set.

Creates an Element from a ui_node map (%{id, type, props, children}).

Returns the inferred accessibility role for this element.

Extracts text content from an element.

Types

t()

@type t() :: %Plushie.Automation.Element{
  children: [t()],
  id: String.t(),
  props: map(),
  type: String.t()
}

Functions

a11y(element)

@spec a11y(element :: t()) :: map() | nil

Returns the a11y props map from the element, or nil if not set.

from_node(node)

@spec from_node(node :: map()) :: t()

Creates an Element from a ui_node map (%{id, type, props, children}).

inferred_role(element)

@spec inferred_role(element :: t()) :: String.t()

Returns the inferred accessibility role for this element.

Mirrors the renderer-side role mapping in plushie_ext::widgets::a11y. If the element has an explicit a11y role override, that takes precedence.

text(element)

@spec text(element :: t()) :: String.t() | nil

Extracts text content from an element.

Checks props in order: "content", "label", "value", "placeholder". Returns nil if no text prop is found.