PlaywrightEx.Request (PlaywrightEx v0.13.0)

Copy Markdown View Source

Interact with a Playwright network request.

Summary

Functions

Waits for the request's response headers and returns {:ok, %{guid: response_id}}.

Types

response_opt()

@type response_opt() :: {:connection, GenServer.name()} | {:timeout, timeout()}

Functions

response(request_id, opts \\ [])

@spec response(PlaywrightEx.guid(), [response_opt() | PlaywrightEx.unknown_opt()]) ::
  {:ok, %{guid: PlaywrightEx.guid()} | nil} | {:error, any()}

Waits for the request's response headers and returns {:ok, %{guid: response_id}}.

Returns {:ok, nil} if the request fails without receiving a response. HTTP error statuses such as 404 still produce a response. Redirects have separate requests; this returns the response for the supplied request.

Response events do not need to be enabled. Read response metadata with PlaywrightEx.Connection.initializer!(connection, response_id).

Reference: https://playwright.dev/docs/api/class-request#request-response

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.