Skip to main content
Version: 24.42.0

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

optional

boolean

Whether to ignore HTTPS errors during navigation.

false

blockList

optional

string[]

(Experimental) A list of URL patterns to block.

This option allows you to restrict the browser from accessing specific URLs or origins. It uses the standard [URLPattern](https://urlpattern.spec.whatwg.org/) API to match URLs.

When connecting to an existing browser, Puppeteer will silently detach from any already open targets that violate the patterns.

For any network requests made by the browser (including navigations and subresources like images or scripts), the request will fail with an error if the URL matches a blocked pattern.

Remarks:

Currently only supported for CDP connections.

browserURL

optional

string

browserWSEndpoint

optional

string

capabilities

optional

SupportedWebDriverCapabilities

WebDriver BiDi capabilities passed to BiDi session.new.

Remarks:

Only works for protocol="webDriverBiDi" and Puppeteer.connect().

channel

optional

ChromeReleaseChannel

(Experimental) If specified, puppeteer looks for an open WebSocket at the well-known default user data directory for the specified channel and attempts to connect to it using ws://localhost:$ActivePort/devtools/browser. Only works for Chrome and when run in Node.js.

This option is experimental when used with puppeteer.connect().

defaultViewport

optional

Viewport | null

Sets the viewport for each page.

'{width: 800, height: 600}'

downloadBehavior

optional

DownloadBehavior

Sets the download behavior for the context.

handleDevToolsAsPage

optional

boolean

Whether to handle the DevTools windows as pages in Puppeteer. Supported only in Chrome with CDP.

'false'

headers

optional

Record<string, string>

Headers to use for the web socket connection.

Remarks:

Only works in the Node.js environment.

issuesEnabled

optional

boolean

(Experimental) Experimental setting to disable monitoring issue events by default.

true

networkEnabled

optional

boolean

(Experimental) Experimental setting to disable monitoring network events by default. When set to false, parts of Puppeteer that depend on network events would not work such as HTTPRequest and HTTPResponse.

true

protocol

optional

ProtocolType

Determined at run time:

  • Launching Chrome - 'cdp'.

  • Launching Firefox - 'webDriverBiDi'.

  • Connecting to a browser - 'cdp'.

protocolTimeout

optional

number

Timeout setting for individual protocol (CDP) calls.

180_000

slowMo

optional

number

Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging.

targetFilter

optional

TargetFilterCallback

Callback to decide if Puppeteer should connect to a given target or not.

transport

optional

ConnectionTransport