LaunchOptions 接口
🌐 LaunchOptions interface
启动任何浏览器时可以传递的通用启动选项。
🌐 Generic launch options that can be passed when launching any browser.
语法
🌐 Signature
export interface LaunchOptions extends ConnectOptions
扩展自: ConnectOptions
属性
🌐 Properties
属性 🌐 Property | 修饰符 🌐 Modifiers | 类型 🌐 Type | 描述 🌐 Description | 默认 🌐 Default |
|---|---|---|---|---|
| args |
| string[] | 要传递给浏览器实例的其他命令行参数。 🌐 Additional command line arguments to pass to the browser instance. | |
| browser |
| 要启动哪个浏览器。 🌐 Which browser to launch. |
| |
| channel |
| 如果为 Chrome 指定,则在已知系统位置查找常规 Chrome 安装,而不是使用打包的 Chrome 二进制文件。 🌐 If specified for Chrome, looks for a regular Chrome installation at a known system location instead of using the bundled Chrome binary. | ||
| debuggingPort |
| number | 指定要使用的调试端口号 🌐 Specify the debugging port number to use | |
| devtools |
| boolean | 是否为每个标签自动打开 DevTools 面板。如果设置为 🌐 Whether to auto-open a DevTools panel for each tab. If this is set to |
|
| dumpio |
| boolean | 如果为真,将浏览器进程的标准输出和标准错误输出管道到 🌐 If true, pipes the browser process stdout and stderr to |
|
| enableExtensions |
| 布尔值 | 字符串数组 🌐 boolean | string[] | 如果 🌐 If | |
| env |
| Record<string, string | undefined> | 指定浏览器可见的环境变量。 🌐 Specify environment variables that will be visible to the browser. |
🌐 The contents of |
| executablePath |
| string | 要使用的浏览器可执行文件的路径,用来替代打包的浏览器。请注意,Puppeteer 仅保证与打包的浏览器一起使用,因此请自行承担使用此设置的风险。 🌐 Path to a browser executable to use instead of the bundled browser. Note that Puppeteer is only guaranteed to work with the bundled browser, so use this setting at your own risk. 附注 使用此功能时,建议设置 🌐 When using this is recommended to set the | |
| extraPrefsFirefox |
| Record<string, unknown> | ||
| handleSIGHUP |
| boolean | 关闭 🌐 Close the browser process on |
|
| handleSIGINT |
| boolean | 关闭 🌐 Close the browser process on |
|
| handleSIGTERM |
| boolean | 关闭 🌐 Close the browser process on |
|
| headless |
| 布尔 |“壳” 🌐 boolean | 'shell' | 是否以无头模式运行浏览器。 🌐 Whether to run the browser in headless mode. 附注 |
|
| ignoreDefaultArgs |
| 布尔值 | 字符串数组 🌐 boolean | string[] | 如果 🌐 If |
|
| pipe |
| boolean | 通过管道连接到浏览器,而不是通过 WebSocket。仅支持 Chrome。 🌐 Connect to a browser over a pipe instead of a WebSocket. Only supported with Chrome. |
|
| signal |
| AbortSignal | 如果提供,当信号被中止时,浏览器将被关闭。 🌐 If provided, the browser will be closed when the signal is aborted. | |
| timeout |
| number | 等待浏览器启动的最长时间(毫秒)。传入 🌐 Maximum time in milliseconds to wait for the browser to start. Pass |
|
| userDataDir |
| string | 用户数据目录的路径。更多信息请参见 Chromium 文档。 🌐 Path to a user data directory. see the Chromium docs for more info. | |
| waitForInitialPage |
| boolean | 是否等待初始页面准备就绪。当用户明确禁用该选项时很有用(例如 Chrome 的 🌐 Whether to wait for the initial page to be ready. Useful when a user explicitly disables that (e.g. |
|