CDPotion.Domain.HeadlessExperimental (cdpotion v0.1.4)

Summary

Types

Encoding options for a screenshot.

Functions

Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a screenshot from the resulting frame. Requires that the target was created with enabled BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also https://goo.gle/chrome-headless-rendering for more background.

Disables headless events for the target.

Enables headless events for the target.

Types

Link to this type

screenshot_params()

@type screenshot_params() :: %{
  format: :jpeg | :png | :webp | nil,
  optimizeForSpeed: boolean() | nil,
  quality: integer() | nil
}

Encoding options for a screenshot.

Functions

Link to this function

begin_frame(frame_time_ticks \\ nil, interval \\ nil, no_display_updates \\ nil, screenshot \\ nil)

@spec begin_frame(
  number(),
  number(),
  boolean(),
  screenshot_params()
) :: {String.t(), map()}

Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a screenshot from the resulting frame. Requires that the target was created with enabled BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also https://goo.gle/chrome-headless-rendering for more background.

Parameters:

  • (Optional) frame_time_ticks: Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
  • (Optional) interval: The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
  • (Optional) no_display_updates: Whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.
  • (Optional) screenshot: If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.
@spec disable() :: {String.t(), map()}

Disables headless events for the target.

@spec enable() :: {String.t(), map()}

Enables headless events for the target.