ConnectOptions 接口
🌐 ConnectOptions interface
启动任何浏览器或连接到现有浏览器实例时可以传递的通用浏览器选项。
🌐 Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance.
语法
🌐 Signature
export interface ConnectOptions
属性
🌐 Properties
属性 🌐 Property | 修饰符 🌐 Modifiers | 类型 🌐 Type | 描述 🌐 Description | 默认 🌐 Default |
|---|---|---|---|---|
| acceptInsecureCerts |
| boolean | 导航期间是否忽略 HTTPS 错误。 🌐 Whether to ignore HTTPS errors during navigation. |
|
| browserURL |
| string | ||
| browserWSEndpoint |
| string | ||
| capabilities |
| WebDriver BiDi 功能已传递给 BiDi 🌐 WebDriver BiDi capabilities passed to BiDi 附注 仅适用于 🌐 Only works for | ||
| channel |
| (实验性) 如果指定,Puppeteer 会在指定渠道的已知默认用户数据目录中查找打开的 WebSocket,并尝试使用 ws://localhost:$ActivePort/devtools/browser 连接它。仅适用于 Chrome 并在 Node.js 中运行时有效。 此选项与 puppeteer.connect() 一起使用时为实验性功能。 🌐 This option is experimental when used with puppeteer.connect(). | ||
| defaultViewport |
| [视窗](./puppeteer.viewport.md) |无效 | 设置每个页面的视口。 🌐 Sets the viewport for each page. | '{width: 800, height: 600}' |
| downloadBehavior |
| 设置上下文的下载行为。 🌐 Sets the download behavior for the context. | ||
| handleDevToolsAsPage |
| boolean | 是否将 DevTools 窗口作为 Puppeteer 中的页面处理。仅在支持 CDP 的 Chrome 中可用。 🌐 Whether to handle the DevTools windows as pages in Puppeteer. Supported only in Chrome with CDP. | 'false' |
| headers |
| Record<string, string> | 用于 Web 套接字连接的标头。 🌐 Headers to use for the web socket connection. 附注 仅适用于 Node.js 环境。 🌐 Only works in the Node.js environment. | |
| networkEnabled |
| boolean | (实验性) 实验性设置,用于默认禁用监控网络事件。设置为 |
|
| protocol |
| 在运行时确定: 🌐 Determined at run time:
| ||
| protocolTimeout |
| number | 单独协议 (CDP) 调用的超时设置。 🌐 Timeout setting for individual protocol (CDP) calls. |
|
| slowMo |
| number | 将 Puppeteer 操作减慢指定的毫秒数以帮助调试。 🌐 Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | |
| targetFilter |
| 用于决定 Puppeteer 是否应连接到给定目标的回调。 🌐 Callback to decide if Puppeteer should connect to a given target or not. | ||
| transport |
|