Skip to main content
Version: Next

API Reference

Classes

ClassDescription
AccessibilityThe Accessibility class provides methods for inspecting the browser'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 browser 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.
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 gather information about parts of JavaScript and CSS that were used by the page.
CSSCoverage
CustomError
DeviceRequestPromptDevice request prompts let you respond to the page requesting for a device through an API like WebBluetooth.
DeviceRequestPromptDeviceDevice in a request prompt.
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.
FileChooserFile choosers let you react to the page requesting for a file.
Frame

Represents a DOM frame.

To understand frames, you can think of frames as <iframe> elements. Just like iframes, frames can be nested, and when JavaScript is executed in a frame, the JavaScript does not effect frames inside the ambient frame the JavaScript executes in.

HTTPRequestRepresents an HTTP request sent by a page.
HTTPResponseThe HTTPResponse class represents responses which are received by the Page class.
JSCoverage
JSHandle

Represents a reference to a JavaScript object. Instances can be created using Page.evaluateHandle().

Handles prevent the referenced JavaScript object from being garbage-collected unless the handle is purposely disposed. JSHandles are auto-disposed when their associated frame is navigated away or the parent context gets destroyed.

Handles can be used as arguments for any evaluation function such as Page.$eval(), Page.evaluate(), and Page.evaluateHandle(). They are resolved to their referenced object.

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.
LocatorLocators describe a strategy of locating elements and performing an action on them. If the action fails because the element is not ready for the action, the whole operation is retried. Various preconditions for a successful action are checked automatically.
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 the browser.

:::note

One Browser instance might have multiple Page instances.

:::

ProductLauncherDescribes a launcher - a class that is able to create and launch a browser instance.
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.
TargetTarget represents a CDP target. In CDP a target is something that can be debugged such a frame, a page or a worker.
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.
WebWorkerThis class represents a WebWorker.

Enumerations

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

Functions

FunctionDescription
clearCustomQueryHandlers()
customQueryHandlerNames()
registerCustomQueryHandler(name, handler)
unregisterCustomQueryHandler(name)

Interfaces

InterfaceDescription
ActionOptions
AutofillData
BoundingBox
BoxModel
BrowserConnectOptionsGeneric browser options that can be passed when launching any browser or when connecting to an existing browser instance.
BrowserContextOptionsBrowserContext options.
BrowserLaunchArgumentOptionsLauncher options that only apply to Chrome.
ClickOptions
CommonEventEmitter
Configuration

Defines options to configure Puppeteer's behavior during installation and runtime.

See individual properties for more information.

ConnectionTransport
ConnectOptions
ConsoleMessageLocation
ContinueRequestOverrides
CoverageEntryThe CoverageEntry class represents one entry of the coverage report.
Credentials
CSSCoverageOptionsSet of configurable options for CSS coverage.
CustomQueryHandler
Device
FrameAddScriptTagOptions
FrameAddStyleTagOptions
FrameWaitForFunctionOptions
GeolocationOptions
InterceptResolutionState
InternalNetworkConditions
JSCoverageEntryThe CoverageEntry class for JavaScript
JSCoverageOptionsSet of configurable options for JS coverage.
KeyboardTypeOptions
KeyDownOptions
LaunchOptionsGeneric launch options that can be passed when launching any browser.
LocatorEventObject
LocatorOptions
LocatorScrollOptions
MediaFeature
Metrics
MouseClickOptions
MouseMoveOptions
MouseOptions
MouseWheelOptions
NetworkConditions
NewDocumentScriptEvaluation
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
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
DEFAULT_INTERCEPT_RESOLUTION_PRIORITYThe default cooperative request interception resolution priority
defaultArgs
devices
errors
executablePath
KnownDevicesA list of devices to be used with Page.emulate().
launch
MouseButtonEnum of valid mouse buttons.
networkConditions
PredefinedNetworkConditionsA list of network conditions to be used with Page.emulateNetworkConditions().
puppeteer
trimCache

Type Aliases

Type AliasDescription
ActionResult
Awaitable
AwaitableIterable
ChromeReleaseChannel
ConsoleMessageTypeThe supported types for console messages.
ElementFor
ErrorCode
EvaluateFunc
EvaluateFuncWith
EventType
ExperimentsConfiguration

Defines experiment options for Puppeteer.

See individual properties for more information.

FlattenHandle
HandleFor
HandleOr
Handler
InnerParams
InterceptResolutionStrategy
KeyInputAll the valid keys that can be passed to functions that take user input, such as keyboard.press
KeyPressOptions
LocatorClickOptions
LowerCasePaperFormat
MouseButton
NodeFor
PaperFormatAll the valid paper format types when printing a PDF.
Permission
Predicate
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
UnionLocatorOf
VisibilityOption