PlaywrightEx.Locator (PlaywrightEx v0.13.0)

Copy Markdown View Source

Client-composed operations on lazy selector queries.

Queries are rooted at a frame and use Playwright selectors, including frame traversal. Target resolution and strictness belong to the browser driver.

Summary

Client-Composed Functions

Waits for one attached element, evaluates on it, and disposes its handle.

Types

evaluate_opt()

@type evaluate_opt() ::
  {:connection, GenServer.name()}
  | {:timeout, timeout()}
  | {:selector, binary()}
  | {:expression, binary()}
  | {:is_function, boolean()}
  | {:arg, term()}

Client-Composed Functions

Helpers composed in this client from multiple channel operations/events, primarily to keep API parity with other Playwright clients where no single server method maps directly.

evaluate(frame_id, opts \\ [])

@spec evaluate(PlaywrightEx.guid(), [evaluate_opt()]) ::
  {:ok, any()} | {:error, any()}

Waits for one attached element, evaluates on it, and disposes its handle.

Follows Playwright JS Locator.evaluate: the timeout covers locating the element, not executing JavaScript; disposal also runs after an evaluation failure. Function expressions receive the element and optional argument. Disposal has no timeout; non-target-closed disposal errors take precedence over the evaluation result. No element handle escapes.

Options

  • :connection (term/0) - The Connection process name. Defaults to PlaywrightEx.Supervisor.Connection. The default value is PlaywrightEx.Supervisor.Connection.

  • :timeout (timeout/0) - Required. Operation timeout in milliseconds. 0 means no waiting; :infinity disables the timeout.

  • :selector (String.t/0) - Required.

  • :expression (String.t/0) - Required.

  • :is_function (boolean/0) - The default value is false.

  • :arg (term/0) - The default value is nil.