Skip to main content
Version: 24.38.0

LaunchOptions 接口

🌐 LaunchOptions interface

语法

🌐 Signature

export interface LaunchOptions

属性

🌐 Properties

属性

🌐 Property

修饰符

🌐 Modifiers

类型

🌐 Type

描述

🌐 Description

默认

🌐 Default

args

optional

string[]

启动时传递给可执行文件的附加参数。

🌐 Additional arguments to pass to the executable when launching.

detached

optional

boolean

是否以 分离 模式生成进程。

🌐 Whether to spawn process in the detached mode.

true 除了在 Windows 上。

dumpio

optional

boolean

如果为 true,则将浏览器进程的 stdout 和 stderr 转发到 Node 进程的 stdout 和 stderr。

🌐 If true, forwards the browser's process stdout and stderr to the Node's process stdout and stderr.

false.

env

optional

Record<string, string | undefined>

为浏览器进程设置的环境变量。

🌐 Environment variables to set for the browser process.

executablePath

string

浏览器可执行文件的绝对路径。

🌐 Absolute path to the browser's executable.

handleSIGHUP

optional

boolean

处理 Node 进程中的 SIGHUP 并尝试正常关闭浏览器进程。

🌐 Handles SIGHUP in the Node process and tries to gracefully close the browser process.

true.

handleSIGINT

optional

boolean

处理 Node 进程中的 SIGINT 并尝试终止浏览器进程。

🌐 Handles SIGINT in the Node process and tries to kill the browser process.

true.

handleSIGTERM

optional

boolean

处理 Node 进程中的 SIGTERM 并尝试正常关闭浏览器进程。

🌐 Handles SIGTERM in the Node process and tries to gracefully close the browser process.

true.

onExit

optional

() => Promise<void>

在浏览器进程退出后或在通过 Process.close() 调用关闭进程之前(包括在处理信号时)运行的回调。该回调只运行一次。

🌐 A callback to run after the browser process exits or before the process will be closed via the Process.close() call (including when handling signals). The callback is only run once.

pipe

optional

boolean

配置 stdio 流以打开两个附加流,以便通过这些流而不是 WebSocket 实现自动化。

🌐 Configures stdio streams to open two additional streams for automation over those streams instead of WebSocket.

false.

signal

optional

AbortSignal

如果提供,当信号被中止时,进程将被终止。

🌐 If provided, the process will be killed when the signal is aborted.