跳到主要内容

HeadlessExperimental🧪

此域仅提供在无头模式下支持的实验性命令。

EN
This domain provides experimental commands only supported in headless mode.

✅️️ Methods

🔨HeadlessExperimental.beginFrame

向目标发送一个BeginFrame,并在该帧完成时返回。可以选择从生成的帧中捕获截图。要求目标在启用BeginFrameControl的情况下创建。专为与--run-all-compositor-stages-before-draw配合使用而设计,更多背景信息请参阅https://goo.gle/chrome-headless-rendering

EN
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.
参数必填标记类型描述原文
frameTimeTicksnumber此BeginFrame在渲染器TimeTicks中的时间戳(正常运行时间的毫秒数)。如果未设置,将使用当前时间。
ENTimestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
intervalnumber报告给合成器的BeginFrames之间的时间间隔,以毫秒为单位。默认值为每秒60帧的间隔,即约16.666毫秒。
ENThe interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
noDisplayUpdatesboolean是否不应将更新提交并绘制到显示器上。默认值为 false。如果为 true,则仅运行 BeginFrame 的副作用,例如布局和动画,但任何视觉更新可能在显示器或屏幕截图中不可见。
ENWhether 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.
screenshotScreenshotParams若设置此参数,将捕获该帧的屏幕截图并在响应中返回。否则,不会捕获屏幕截图。请注意,捕获屏幕截图可能失败,例如在渲染器初始化期间。这种情况下,不会返回任何屏幕截图数据。
ENIf 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.
返回对象类型描述原文
hasDamagebooleanBeginFrame是否导致了画面损坏,并因此向显示器提交了一个新帧。此报告用于诊断目的,未来可能会被移除。
ENWhether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
screenshotDatastring截图的Base64编码图像数据,如果已请求并成功拍摄。(通过JSON传递时编码为base64字符串)
ENBase64-encoded image data of the screenshot, if one was requested and successfully taken. (Encoded as a base64 string when passed over JSON)

🔨HeadlessExperimental.disable❌️

为目标禁用无头事件。

EN
Disables headless events for the target.

🔨HeadlessExperimental.enable❌️

为目标启用无头事件。

EN
Enables headless events for the target.

✅️️ Types

📌HeadlessExperimental.ScreenshotParams

截图的编码选项。

EN
Encoding options for a screenshot.

返回类型:object

属性必填标记类型描述原文
formatstring图像压缩格式(默认为 png)。
允许的取值:jpegpngwebp
ENImage compression format (defaults to png).
Allowed Values: jpeg, png, webp
qualityinteger压缩质量范围在 [0..100] 之间(仅适用于 jpeg 和 webp 格式)。
ENCompression quality from range [0..100] (jpeg and webp only).
optimizeForSpeedboolean优化图像编码以提升速度,而非压缩最终文件大小(默认值为 false)
ENOptimize image encoding for speed, not for resulting size (defaults to false)