Skip to main content
Version: Next

API Reference

Classes

ClassDescription
AccessibilityThe Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as screen readers or switches.
BrowserA Browser is created when Puppeteer connects to a Chromium instance, either through PuppeteerNode.launch() or Puppeteer.connect().
BrowserContextBrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method Browser.newPage creates a page in the default browser context.
BrowserFetcherBrowserFetcher can download and manage different versions of Chromium and Firefox.
CDPSessionThe CDPSession instances are used to talk raw Chrome Devtools Protocol.
Connection
ConsoleMessageConsoleMessage objects are dispatched by page via the 'console' event.
CoverageThe Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page.
CSSCoverage
CustomError
DialogDialog instances are dispatched by the Page via the dialog event.
ElementHandleElementHandle represents an in-page DOM element.
EventEmitterThe EventEmitter class that many Puppeteer classes extend.
ExecutionContext

This class represents a context for JavaScript execution. A [Page] might have many execution contexts: - each frame has "default" execution context that is always created after frame is attached to DOM. This context is returned by the Frame.executionContext() method. - Extension's content scripts create additional execution contexts.

Besides pages, execution contexts can be found in workers.

FileChooserFile choosers let you react to the page requesting for a file.
FrameAt every point of time, page exposes its current frame tree via the page.mainFrame and frame.childFrames methods.
HTTPRequestRepresents an HTTP request sent by a page.
HTTPResponseThe HTTPResponse class represents responses which are received by the Page class.
JSCoverage
JSHandleRepresents an in-page JavaScript object. JSHandles can be created with the page.evaluateHandle method.
KeyboardKeyboard provides an api for managing a virtual keyboard. The high level api is Keyboard.type(), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page.
MouseThe Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
Page

Page provides methods to interact with a single tab or extension background page in Chromium.

:::note

One Browser instance might have multiple Page instances.

:::

ProtocolErrorProtocolError is emitted whenever there is an error from the protocol.
Puppeteer

The main Puppeteer class.

IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of PuppeteerNode when you import or require puppeteer. That class extends Puppeteer, so has all the methods documented below as well as all that are defined on PuppeteerNode.

PuppeteerNode

Extends the main Puppeteer class with Node specific behaviour for fetching and downloading browsers.

If you're using Puppeteer in a Node environment, this is the class you'll get when you run require('puppeteer') (or the equivalent ES import).

SecurityDetailsThe SecurityDetails class represents the security details of a response that was received over a secure connection.
Target
TimeoutErrorTimeoutError is emitted whenever certain operations are terminated due to timeout.
TouchscreenThe Touchscreen class exposes touchscreen events.
TracingThe Tracing class exposes the tracing audit interface.
WebWorkerThe WebWorker class represents a WebWorker.

Enumerations

EnumerationDescription
BrowserContextEmittedEvents
BrowserEmittedEventsAll the events a browser instance may emit.
InterceptResolutionAction
PageEmittedEventsAll the events that a page instance may emit.

Functions

FunctionDescription
clearCustomQueryHandlers()Clears all registered handlers.
customQueryHandlerNames()
registerCustomQueryHandler(name, handler)Registers a custom query handler.
unregisterCustomQueryHandler(name)

Interfaces

InterfaceDescription
BoundingBox
BoxModel
BrowserConnectOptionsGeneric browser options that can be passed when launching any browser or when connecting to an existing browser instance.
BrowserContextOptionsBrowserContext options.
BrowserFetcherOptions
BrowserFetcherRevisionInfo
BrowserLaunchArgumentOptionsLauncher options that only apply to Chrome.
CDPSessionOnMessageObject
ClickOptions
CommonEventEmitter
ConnectionCallback
ConnectionTransport
ConnectOptions
ConsoleMessageLocation
ContinueRequestOverrides
CoverageEntryThe CoverageEntry class represents one entry of the coverage report.
Credentials
CSSCoverageOptionsSet of configurable options for CSS coverage.
CustomQueryHandlerContains two functions queryOne and queryAll that can be registered as alternative querying strategies. The functions queryOne and queryAll are executed in the page context. queryOne should take an Element and a selector string as argument and return a single Element or null if no element is found. queryAll takes the same arguments but should instead return a NodeListOf<Element> or Array<Element> with all the elements that match the given query selector.
Device
FrameAddScriptTagOptions
FrameAddStyleTagOptions
FrameWaitForFunctionOptions
GeolocationOptions
InterceptResolutionState
InternalNetworkConditions
JSCoverageEntryThe CoverageEntry class for JavaScript
JSCoverageOptionsSet of configurable options for JS coverage.
LaunchOptionsGeneric launch options that can be passed when launching any browser.
MediaFeature
Metrics
MouseOptions
MouseWheelOptions
NetworkConditions
Offset
PageEventObject

Denotes the objects received by callback functions for page events.

See PageEmittedEvents for more detail on the events and when they are emitted.

PDFMargin
PDFOptionsValid options to configure PDF generation via Page.pdf().
Point
PressOptions
ProductLauncherDescribes a launcher - a class that is able to create and launch a browser instance.
PuppeteerErrors
PuppeteerLaunchOptions
RemoteAddress
ResponseForRequestRequired response data to fulfill a request with.
ScreenshotClip
ScreenshotOptions
SerializedAXNodeRepresents a Node and the properties of it that are relevant to Accessibility.
SnapshotOptions
TracingOptions
ViewportSets the viewport of the page.
WaitForOptions
WaitForSelectorOptions
WaitForTargetOptions
WaitTimeoutOptions

Variables

VariableDescription
connect
createBrowserFetcher
DEFAULT_INTERCEPT_RESOLUTION_PRIORITYThe default cooperative request interception resolution priority
defaultArgs
devicesA list of devices to be used with page.emulate(options). Actual list of devices can be found in src/common/DeviceDescriptors.ts.
errors

Puppeteer methods might throw errors if they are unable to fulfill a request. For example, page.waitForSelector(selector[, options]) might fail if the selector doesn't match any nodes during the given timeframe.

For certain types of errors Puppeteer uses specific error classes. These classes are available via puppeteer.errors.

EVALUATION_SCRIPT_URL
executablePath
launch
networkConditionsA list of network conditions to be used with page.emulateNetworkConditions(networkConditions). Actual list of predefined conditions can be found in src/common/NetworkConditions.ts.

Type Aliases

Type AliasDescription
ActionResult
Awaitable
ChromeReleaseChannel
ConsoleMessageTypeThe supported types for console messages.
DevicesMap
ErrorCode
EvaluateFunc
EventType
FlattenHandle
HandleFor
HandleOr
Handler
InnerParams
InterceptResolutionStrategy
KeyInputAll the valid keys that can be passed to functions that take user input, such as keyboard.press
LowerCasePaperFormat
MouseButton
NodeFor
PaperFormatAll the valid paper format types when printing a PDF.
Permission
PlatformSupported platforms.
ProductSupported products.
ProtocolLifeCycleEvent
PuppeteerLifeCycleEvent
PuppeteerNodeLaunchOptionsUtility type exposed to enable users to define options that can be passed to puppeteer.launch without having to list the set of all types.
ResourceTypeResource types for HTTPRequests as perceived by the rendering engine.
TargetFilterCallback