54 KiB
sidebar_label |
---|
API |
API Reference
Classes
Class | Description |
---|---|
Accessibility | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as screen readers or switches. |
Browser | A Browser is created when Puppeteer connects to a Chromium instance, either through PuppeteerNode.launch() or Puppeteer.connect(). |
BrowserContext | BrowserContexts 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. |
BrowserFetcher | BrowserFetcher can download and manage different versions of Chromium and Firefox. |
CDPSession | The CDPSession instances are used to talk raw Chrome Devtools Protocol. |
Connection | |
ConsoleMessage | ConsoleMessage objects are dispatched by page via the 'console' event. |
Coverage | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. |
CSSCoverage | |
CustomError | |
Dialog | Dialog instances are dispatched by the Page via the dialog event. |
ElementHandle | ElementHandle represents an in-page DOM element. |
EventEmitter | The EventEmitter class that many Puppeteer classes extend. |
FileChooser | File 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 |
HTTPRequest | Represents an HTTP request sent by a page. |
HTTPResponse | The 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. |
Keyboard | Keyboard 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. |
Mouse | The 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. ::: |
ProtocolError | ProtocolError 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 |
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 |
SecurityDetails | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
Target | |
TimeoutError | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
Touchscreen | The Touchscreen class exposes touchscreen events. |
Tracing | The Tracing class exposes the tracing audit interface. |
WebWorker | This class represents a WebWorker. |
Enumerations
Enumeration | Description |
---|---|
BrowserContextEmittedEvents | |
BrowserEmittedEvents | All the events a browser instance may emit. |
InterceptResolutionAction | |
PageEmittedEvents | All the events that a page instance may emit. |
Functions
Function | Description |
---|---|
clearCustomQueryHandlers() | Clears all registered handlers. |
customQueryHandlerNames() | |
registerCustomQueryHandler(name, handler) | Registers a custom query handler. |
unregisterCustomQueryHandler(name) |
Interfaces
Interface | Description |
---|---|
BoundingBox | |
BoxModel | |
BrowserConnectOptions | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. |
BrowserContextOptions | BrowserContext options. |
BrowserFetcherOptions | |
BrowserFetcherRevisionInfo | |
BrowserLaunchArgumentOptions | Launcher options that only apply to Chrome. |
CDPSessionOnMessageObject | |
ClickOptions | |
CommonEventEmitter | |
ConnectionCallback | |
ConnectionTransport | |
ConnectOptions | |
ConsoleMessageLocation | |
ContinueRequestOverrides | |
CoverageEntry | The CoverageEntry class represents one entry of the coverage report. |
Credentials | |
CSSCoverageOptions | Set of configurable options for CSS coverage. |
CustomQueryHandler | |
Device | |
FrameAddScriptTagOptions | |
FrameAddStyleTagOptions | |
FrameWaitForFunctionOptions | |
GeolocationOptions | |
InterceptResolutionState | |
InternalNetworkConditions | |
JSCoverageEntry | The CoverageEntry class for JavaScript |
JSCoverageOptions | Set of configurable options for JS coverage. |
LaunchOptions | Generic 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 | |
PDFOptions | Valid options to configure PDF generation via Page.pdf(). |
Point | |
PressOptions | |
ProductLauncher | Describes a launcher - a class that is able to create and launch a browser instance. |
PuppeteerErrors | |
PuppeteerLaunchOptions | |
RemoteAddress | |
ResponseForRequest | Required response data to fulfill a request with. |
ScreenshotClip | |
ScreenshotOptions | |
SerializedAXNode | Represents a Node and the properties of it that are relevant to Accessibility. |
SnapshotOptions | |
TracingOptions | |
Viewport | Sets the viewport of the page. |
WaitForOptions | |
WaitForSelectorOptions | |
WaitForTargetOptions | |
WaitTimeoutOptions |
Variables
Variable | Description |
---|---|
connect | |
createBrowserFetcher | |
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY | The default cooperative request interception resolution priority |
defaultArgs | |
devices | A 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, For certain types of errors Puppeteer uses specific error classes. These classes are available via |
EVALUATION_SCRIPT_URL | |
executablePath | |
launch | |
networkConditions | A 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 Alias | Description |
---|---|
ActionResult | |
Awaitable | |
ChromeReleaseChannel | |
ConsoleMessageType | The supported types for console messages. |
DevicesMap | |
ErrorCode | |
EvaluateFunc | |
EventType | |
FlattenHandle | |
HandleFor | |
HandleOr | |
Handler | |
InnerParams | |
InterceptResolutionStrategy | |
KeyInput | All the valid keys that can be passed to functions that take user input, such as keyboard.press |
LowerCasePaperFormat | |
MouseButton | |
NodeFor | |
PaperFormat | All the valid paper format types when printing a PDF. |
Permission | |
Platform | Supported platforms. |
Product | Supported products. |
ProtocolLifeCycleEvent | |
PuppeteerLifeCycleEvent | |
PuppeteerNodeLaunchOptions | Utility type exposed to enable users to define options that can be passed to puppeteer.launch without having to list the set of all types. |
ResourceType | Resource types for HTTPRequests as perceived by the rendering engine. |
TargetFilterCallback |