PlaywrightEx.Page (PlaywrightEx v0.2.0)

View Source

Interact with a Playwright Page.

There is no official documentation, since this is considered Playwright internal.

References:

Summary

Functions

Returns a screenshot of the page as binary data.

Updates the subscription for page events.

Types

screenshot_opt()

@type screenshot_opt() ::
  {:timeout, timeout()}
  | {:full_page, boolean()}
  | {:omit_background, boolean()}

update_subscription_opt()

@type update_subscription_opt() ::
  {:timeout, timeout()} | {:event, atom()} | {:enabled, boolean()}

Functions

screenshot(page_id, opts \\ [])

@spec screenshot(PlaywrightEx.guid(), [screenshot_opt() | PlaywrightEx.unknown_opt()]) ::
  {:ok, binary()} | {:error, any()}

Returns a screenshot of the page as binary data.

Reference: https://playwright.dev/docs/api/class-page#page-screenshot

Options

  • :timeout (timeout/0) - Required. Maximum time for the operation (milliseconds).

  • :full_page (boolean/0) - When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Defaults to false.

  • :omit_background (boolean/0) - Hides default white background and allows capturing screenshots with transparency. Defaults to false. Not applicable to jpeg images.

update_subscription(page_id, opts \\ [])

@spec update_subscription(PlaywrightEx.guid(), [
  update_subscription_opt() | PlaywrightEx.unknown_opt()
]) ::
  {:ok, any()} | {:error, any()}

Updates the subscription for page events.

Reference: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/page.ts

Options

  • :timeout (timeout/0) - Required. Maximum time for the operation (milliseconds).

  • :event (atom/0) - Required.

  • :enabled (boolean/0) - The default value is true.