chore(main): release 15.3.1 (#8635)
* chore(main): release 15.3.1 * chore: generate versioned docs Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This commit is contained in:
parent
4cd97e93f9
commit
ec8c750383
@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "15.3.0"
|
||||
".": "15.3.1"
|
||||
}
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [15.3.1](https://github.com/puppeteer/puppeteer/compare/v15.3.0...v15.3.1) (2022-07-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* extends `ElementHandle` to `Node`s ([#8552](https://github.com/puppeteer/puppeteer/issues/8552)) ([5ff205d](https://github.com/puppeteer/puppeteer/commit/5ff205dc8b659eb8864b4b1862105d21dd334c8f))
|
||||
|
||||
## [15.3.0](https://github.com/puppeteer/puppeteer/compare/v15.2.0...v15.3.0) (2022-07-01)
|
||||
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "puppeteer",
|
||||
"version": "15.3.0",
|
||||
"version": "15.3.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "puppeteer",
|
||||
"version": "15.3.0",
|
||||
"version": "15.3.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "puppeteer",
|
||||
"version": "15.3.0",
|
||||
"version": "15.3.1",
|
||||
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
|
||||
"keywords": [
|
||||
"puppeteer",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const packageVersion = '15.3.0';
|
||||
export const packageVersion = '15.3.1';
|
||||
|
167
website/versioned_docs/version-15.3.1/api/index.md
Normal file
167
website/versioned_docs/version-15.3.1/api/index.md
Normal file
@ -0,0 +1,167 @@
|
||||
---
|
||||
sidebar_label: API
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
## Classes
|
||||
|
||||
| Class | Description |
|
||||
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). |
|
||||
| [Browser](./puppeteer.browser.md) | A Browser is created when Puppeteer connects to a Chromium instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
||||
| [BrowserContext](./puppeteer.browsercontext.md) | 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](./puppeteer.browser.newpage.md) creates a page in the default browser context. |
|
||||
| [BrowserFetcher](./puppeteer.browserfetcher.md) | BrowserFetcher can download and manage different versions of Chromium and Firefox. |
|
||||
| [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. |
|
||||
| [Connection](./puppeteer.connection.md) | |
|
||||
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
|
||||
| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. |
|
||||
| [CSSCoverage](./puppeteer.csscoverage.md) | |
|
||||
| [CustomError](./puppeteer.customerror.md) | |
|
||||
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
|
||||
| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. |
|
||||
| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. |
|
||||
| [ExecutionContext](./puppeteer.executioncontext.md) | <p>This class represents a context for JavaScript execution. A \[Page\] might have many execution contexts: - each [frame](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) has "default" execution context that is always created after frame is attached to DOM. This context is returned by the [Frame.executionContext()](./puppeteer.frame.executioncontext.md) method. - [Extension](https://developer.chrome.com/extensions)'s content scripts create additional execution contexts.</p><p>Besides pages, execution contexts can be found in [workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).</p> |
|
||||
| [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. |
|
||||
| [Frame](./puppeteer.frame.md) | At every point of time, page exposes its current frame tree via the [page.mainFrame](./puppeteer.page.mainframe.md) and [frame.childFrames](./puppeteer.frame.childframes.md) methods. |
|
||||
| [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. |
|
||||
| [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. |
|
||||
| [JSCoverage](./puppeteer.jscoverage.md) | |
|
||||
| [JSHandle](./puppeteer.jshandle.md) | Represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle](./puppeteer.page.evaluatehandle.md) method. |
|
||||
| [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. |
|
||||
| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. |
|
||||
| [Page](./puppeteer.page.md) | <p>Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium.</p><p>:::note</p><p>One Browser instance might have multiple Page instances.</p><p>:::</p> |
|
||||
| [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. |
|
||||
| [Puppeteer](./puppeteer.puppeteer.md) | <p>The main Puppeteer class.</p><p>IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require <code>puppeteer</code>. That class extends <code>Puppeteer</code>, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).</p> |
|
||||
| [PuppeteerNode](./puppeteer.puppeteernode.md) | <p>Extends the main [Puppeteer](./puppeteer.puppeteer.md) class with Node specific behaviour for fetching and downloading browsers.</p><p>If you're using Puppeteer in a Node environment, this is the class you'll get when you run <code>require('puppeteer')</code> (or the equivalent ES <code>import</code>).</p> |
|
||||
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
|
||||
| [Target](./puppeteer.target.md) | |
|
||||
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
||||
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
||||
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. |
|
||||
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
|
||||
|
||||
## Enumerations
|
||||
|
||||
| Enumeration | Description |
|
||||
| ------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
||||
| [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) | |
|
||||
| [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. |
|
||||
| [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | |
|
||||
| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| [clearCustomQueryHandlers()](./puppeteer.clearcustomqueryhandlers.md) | Clears all registered handlers. |
|
||||
| [customQueryHandlerNames()](./puppeteer.customqueryhandlernames.md) | |
|
||||
| [registerCustomQueryHandler(name, handler)](./puppeteer.registercustomqueryhandler.md) | Registers a [custom query handler](./puppeteer.customqueryhandler.md). |
|
||||
| [unregisterCustomQueryHandler(name)](./puppeteer.unregistercustomqueryhandler.md) | |
|
||||
|
||||
## Interfaces
|
||||
|
||||
| Interface | Description |
|
||||
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [BoundingBox](./puppeteer.boundingbox.md) | |
|
||||
| [BoxModel](./puppeteer.boxmodel.md) | |
|
||||
| [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. |
|
||||
| [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. |
|
||||
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
|
||||
| [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) | |
|
||||
| [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. |
|
||||
| [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | |
|
||||
| [ClickOptions](./puppeteer.clickoptions.md) | |
|
||||
| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | |
|
||||
| [ConnectionCallback](./puppeteer.connectioncallback.md) | |
|
||||
| [ConnectionTransport](./puppeteer.connectiontransport.md) | |
|
||||
| [ConnectOptions](./puppeteer.connectoptions.md) | |
|
||||
| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | |
|
||||
| [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | |
|
||||
| [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. |
|
||||
| [Credentials](./puppeteer.credentials.md) | |
|
||||
| [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. |
|
||||
| [CustomQueryHandler](./puppeteer.customqueryhandler.md) | Contains two functions <code>queryOne</code> and <code>queryAll</code> that can be [registered](./puppeteer.registercustomqueryhandler.md) as alternative querying strategies. The functions <code>queryOne</code> and <code>queryAll</code> are executed in the page context. <code>queryOne</code> should take an <code>Element</code> and a selector string as argument and return a single <code>Element</code> or <code>null</code> if no element is found. <code>queryAll</code> takes the same arguments but should instead return a <code>NodeListOf<Element></code> or <code>Array<Element></code> with all the elements that match the given query selector. |
|
||||
| [Device](./puppeteer.device.md) | |
|
||||
| [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | |
|
||||
| [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | |
|
||||
| [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | |
|
||||
| [GeolocationOptions](./puppeteer.geolocationoptions.md) | |
|
||||
| [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) | |
|
||||
| [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | |
|
||||
| [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript |
|
||||
| [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. |
|
||||
| [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. |
|
||||
| [MediaFeature](./puppeteer.mediafeature.md) | |
|
||||
| [Metrics](./puppeteer.metrics.md) | |
|
||||
| [MouseOptions](./puppeteer.mouseoptions.md) | |
|
||||
| [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | |
|
||||
| [NetworkConditions](./puppeteer.networkconditions.md) | |
|
||||
| [Offset](./puppeteer.offset.md) | |
|
||||
| [PageEventObject](./puppeteer.pageeventobject.md) | <p>Denotes the objects received by callback functions for page events.</p><p>See [PageEmittedEvents](./puppeteer.pageemittedevents.md) for more detail on the events and when they are emitted.</p> |
|
||||
| [PDFMargin](./puppeteer.pdfmargin.md) | |
|
||||
| [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). |
|
||||
| [Point](./puppeteer.point.md) | |
|
||||
| [PressOptions](./puppeteer.pressoptions.md) | |
|
||||
| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. |
|
||||
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
|
||||
| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | |
|
||||
| [RemoteAddress](./puppeteer.remoteaddress.md) | |
|
||||
| [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. |
|
||||
| [ScreenshotClip](./puppeteer.screenshotclip.md) | |
|
||||
| [ScreenshotOptions](./puppeteer.screenshotoptions.md) | |
|
||||
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
|
||||
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
||||
| [TracingOptions](./puppeteer.tracingoptions.md) | |
|
||||
| [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. |
|
||||
| [WaitForOptions](./puppeteer.waitforoptions.md) | |
|
||||
| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | |
|
||||
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
|
||||
| [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | |
|
||||
|
||||
## Variables
|
||||
|
||||
| Variable | Description |
|
||||
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [connect](./puppeteer.connect.md) | |
|
||||
| [createBrowserFetcher](./puppeteer.createbrowserfetcher.md) | |
|
||||
| [DEFAULT_INTERCEPT_RESOLUTION_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority |
|
||||
| [defaultArgs](./puppeteer.defaultargs.md) | |
|
||||
| [devices](./puppeteer.devices.md) | A list of devices to be used with <code>page.emulate(options)</code>. Actual list of devices can be found in [src/common/DeviceDescriptors.ts](https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts). |
|
||||
| [errors](./puppeteer.errors.md) | <p>Puppeteer methods might throw errors if they are unable to fulfill a request. For example, <code>page.waitForSelector(selector[, options])</code> might fail if the selector doesn't match any nodes during the given timeframe.</p><p>For certain types of errors Puppeteer uses specific error classes. These classes are available via <code>puppeteer.errors</code>.</p> |
|
||||
| [EVALUATION_SCRIPT_URL](./puppeteer.evaluation_script_url.md) | |
|
||||
| [executablePath](./puppeteer.executablepath.md) | |
|
||||
| [launch](./puppeteer.launch.md) | |
|
||||
| [networkConditions](./puppeteer.networkconditions.md) | A list of network conditions to be used with <code>page.emulateNetworkConditions(networkConditions)</code>. Actual list of predefined conditions can be found in [src/common/NetworkConditions.ts](https://github.com/puppeteer/puppeteer/blob/main/src/common/NetworkConditions.ts). |
|
||||
|
||||
## Type Aliases
|
||||
|
||||
| Type Alias | Description |
|
||||
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [ActionResult](./puppeteer.actionresult.md) | |
|
||||
| [Awaitable](./puppeteer.awaitable.md) | |
|
||||
| [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | |
|
||||
| [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. |
|
||||
| [DevicesMap](./puppeteer.devicesmap.md) | |
|
||||
| [ErrorCode](./puppeteer.errorcode.md) | |
|
||||
| [EvaluateFunc](./puppeteer.evaluatefunc.md) | |
|
||||
| [EventType](./puppeteer.eventtype.md) | |
|
||||
| [FlattenHandle](./puppeteer.flattenhandle.md) | |
|
||||
| [HandleFor](./puppeteer.handlefor.md) | |
|
||||
| [HandleOr](./puppeteer.handleor.md) | |
|
||||
| [Handler](./puppeteer.handler.md) | |
|
||||
| [InnerParams](./puppeteer.innerparams.md) | |
|
||||
| [InterceptResolutionStrategy](./puppeteer.interceptresolutionstrategy.md) | |
|
||||
| [KeyInput](./puppeteer.keyinput.md) | All the valid keys that can be passed to functions that take user input, such as [keyboard.press](./puppeteer.keyboard.press.md) |
|
||||
| [LowerCasePaperFormat](./puppeteer.lowercasepaperformat.md) | |
|
||||
| [MouseButton](./puppeteer.mousebutton.md) | |
|
||||
| [NodeFor](./puppeteer.nodefor.md) | |
|
||||
| [PaperFormat](./puppeteer.paperformat.md) | All the valid paper format types when printing a PDF. |
|
||||
| [Permission](./puppeteer.permission.md) | |
|
||||
| [Platform](./puppeteer.platform.md) | Supported platforms. |
|
||||
| [Product](./puppeteer.product.md) | Supported products. |
|
||||
| [ProtocolLifeCycleEvent](./puppeteer.protocollifecycleevent.md) | |
|
||||
| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | |
|
||||
| [PuppeteerNodeLaunchOptions](./puppeteer.puppeteernodelaunchoptions.md) | Utility type exposed to enable users to define options that can be passed to <code>puppeteer.launch</code> without having to list the set of all types. |
|
||||
| [ResourceType](./puppeteer.resourcetype.md) | Resource types for HTTPRequests as perceived by the rendering engine. |
|
||||
| [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | |
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
sidebar_label: Accessibility
|
||||
---
|
||||
|
||||
# Accessibility class
|
||||
|
||||
The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class Accessibility
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.
|
||||
|
||||
Blink - Chrome's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.
|
||||
|
||||
Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Accessibility` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |
|
@ -0,0 +1,59 @@
|
||||
---
|
||||
sidebar_label: Accessibility.snapshot
|
||||
---
|
||||
|
||||
# Accessibility.snapshot() method
|
||||
|
||||
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Accessibility {
|
||||
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode | null>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------------------------------------------------- | ----------------- |
|
||||
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | <i>(Optional)</i> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[SerializedAXNode](./puppeteer.serializedaxnode.md) \| null>
|
||||
|
||||
An AXNode object representing the snapshot.
|
||||
|
||||
## Remarks
|
||||
|
||||
\*\*NOTE\*\* The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
||||
|
||||
## Example 1
|
||||
|
||||
An example of dumping the entire accessibility tree:
|
||||
|
||||
```ts
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
console.log(snapshot);
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of logging the focused node's name:
|
||||
|
||||
```ts
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
const node = findFocusedNode(snapshot);
|
||||
console.log(node && node.name);
|
||||
|
||||
function findFocusedNode(node) {
|
||||
if (node.focused) return node;
|
||||
for (const child of node.children || []) {
|
||||
const foundNode = findFocusedNode(child);
|
||||
return foundNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
sidebar_label: ActionResult
|
||||
---
|
||||
|
||||
# ActionResult type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare type ActionResult = 'continue' | 'abort' | 'respond';
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
sidebar_label: Awaitable
|
||||
---
|
||||
|
||||
# Awaitable type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare type Awaitable<T> = T | PromiseLike<T>;
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BoundingBox.height
|
||||
---
|
||||
|
||||
# BoundingBox.height property
|
||||
|
||||
the height of the element in pixels.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoundingBox {
|
||||
height: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
sidebar_label: BoundingBox
|
||||
---
|
||||
|
||||
# BoundingBox interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BoundingBox extends Point
|
||||
```
|
||||
|
||||
**Extends:** [Point](./puppeteer.point.md)
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ------------------------------------------- | --------- | ------ | ------------------------------------ |
|
||||
| [height](./puppeteer.boundingbox.height.md) | | number | the height of the element in pixels. |
|
||||
| [width](./puppeteer.boundingbox.width.md) | | number | the width of the element in pixels. |
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BoundingBox.width
|
||||
---
|
||||
|
||||
# BoundingBox.width property
|
||||
|
||||
the width of the element in pixels.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoundingBox {
|
||||
width: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.border
|
||||
---
|
||||
|
||||
# BoxModel.border property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
border: Point[];
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.content
|
||||
---
|
||||
|
||||
# BoxModel.content property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
content: Point[];
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.height
|
||||
---
|
||||
|
||||
# BoxModel.height property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
height: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.margin
|
||||
---
|
||||
|
||||
# BoxModel.margin property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
margin: Point[];
|
||||
}
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
sidebar_label: BoxModel
|
||||
---
|
||||
|
||||
# BoxModel interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BoxModel
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ------------------------------------------ | --------- | --------------------------------- | ----------- |
|
||||
| [border](./puppeteer.boxmodel.border.md) | | [Point](./puppeteer.point.md)\[\] | |
|
||||
| [content](./puppeteer.boxmodel.content.md) | | [Point](./puppeteer.point.md)\[\] | |
|
||||
| [height](./puppeteer.boxmodel.height.md) | | number | |
|
||||
| [margin](./puppeteer.boxmodel.margin.md) | | [Point](./puppeteer.point.md)\[\] | |
|
||||
| [padding](./puppeteer.boxmodel.padding.md) | | [Point](./puppeteer.point.md)\[\] | |
|
||||
| [width](./puppeteer.boxmodel.width.md) | | number | |
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.padding
|
||||
---
|
||||
|
||||
# BoxModel.padding property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
padding: Point[];
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BoxModel.width
|
||||
---
|
||||
|
||||
# BoxModel.width property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BoxModel {
|
||||
width: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.browserContexts
|
||||
---
|
||||
|
||||
# Browser.browserContexts() method
|
||||
|
||||
Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
browserContexts(): BrowserContext[];
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md)\[\]
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.close
|
||||
---
|
||||
|
||||
# Browser.close() method
|
||||
|
||||
Closes Chromium and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
close(): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
@ -0,0 +1,41 @@
|
||||
---
|
||||
sidebar_label: Browser.createIncognitoBrowserContext
|
||||
---
|
||||
|
||||
# Browser.createIncognitoBrowserContext() method
|
||||
|
||||
Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
createIncognitoBrowserContext(
|
||||
options?: BrowserContextOptions
|
||||
): Promise<BrowserContext>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------------------------------------------------------------- | ----------------- |
|
||||
| options | [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | <i>(Optional)</i> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[BrowserContext](./puppeteer.browsercontext.md)>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
// Create a new incognito browser context.
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page in a pristine context.
|
||||
const page = await context.newPage();
|
||||
// Do stuff
|
||||
await page.goto('https://example.com');
|
||||
})();
|
||||
```
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.defaultBrowserContext
|
||||
---
|
||||
|
||||
# Browser.defaultBrowserContext() method
|
||||
|
||||
Returns the default browser context. The default browser context cannot be closed.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
defaultBrowserContext(): BrowserContext;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md)
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.disconnect
|
||||
---
|
||||
|
||||
# Browser.disconnect() method
|
||||
|
||||
Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling `disconnect`, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
disconnect(): void;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.isConnected
|
||||
---
|
||||
|
||||
# Browser.isConnected() method
|
||||
|
||||
Indicates that the browser is connected.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
isConnected(): boolean;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
boolean
|
@ -0,0 +1,77 @@
|
||||
---
|
||||
sidebar_label: Browser
|
||||
---
|
||||
|
||||
# Browser class
|
||||
|
||||
A Browser is created when Puppeteer connects to a Chromium instance, either through [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md) or [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class Browser extends EventEmitter
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) enum.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Browser` class.
|
||||
|
||||
## Example 1
|
||||
|
||||
An example of using a [Browser](./puppeteer.browser.md) to create a [Page](./puppeteer.page.md):
|
||||
|
||||
```ts
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://example.com');
|
||||
await browser.close();
|
||||
})();
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of disconnecting from and reconnecting to a [Browser](./puppeteer.browser.md):
|
||||
|
||||
```ts
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
// Store the endpoint to be able to reconnect to Chromium
|
||||
const browserWSEndpoint = browser.wsEndpoint();
|
||||
// Disconnect puppeteer from Chromium
|
||||
browser.disconnect();
|
||||
|
||||
// Use the endpoint to reestablish a connection
|
||||
const browser2 = await puppeteer.connect({browserWSEndpoint});
|
||||
// Close Chromium
|
||||
await browser2.close();
|
||||
})();
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md). |
|
||||
| [close()](./puppeteer.browser.close.md) | | Closes Chromium and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. |
|
||||
| [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. |
|
||||
| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. |
|
||||
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling <code>disconnect</code>, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. |
|
||||
| [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. |
|
||||
| [newPage()](./puppeteer.browser.newpage.md) | | Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context. |
|
||||
| [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside the Browser. |
|
||||
| [process()](./puppeteer.browser.process.md) | | The spawned browser process. Returns <code>null</code> if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
||||
| [target()](./puppeteer.browser.target.md) | | The target associated with the browser. |
|
||||
| [targets()](./puppeteer.browser.targets.md) | | All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts. |
|
||||
| [userAgent()](./puppeteer.browser.useragent.md) | | The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md). |
|
||||
| [version()](./puppeteer.browser.version.md) | | A string representing the browser name and version. |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | Searches for a target in all browser contexts. |
|
||||
| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.newPage
|
||||
---
|
||||
|
||||
# Browser.newPage() method
|
||||
|
||||
Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
newPage(): Promise<Page>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)>
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_label: Browser.pages
|
||||
---
|
||||
|
||||
# Browser.pages() method
|
||||
|
||||
An array of all open pages inside the Browser.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
pages(): Promise<Page[]>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)\[\]>
|
||||
|
||||
## Remarks
|
||||
|
||||
In case of multiple browser contexts, returns an array with all the pages in all browser contexts. Non-visible pages, such as `"background_page"`, will not be listed here. You can find them using [Target.page()](./puppeteer.target.page.md).
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.process
|
||||
---
|
||||
|
||||
# Browser.process() method
|
||||
|
||||
The spawned browser process. Returns `null` if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
process(): ChildProcess | null;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
ChildProcess \| null
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.target
|
||||
---
|
||||
|
||||
# Browser.target() method
|
||||
|
||||
The target associated with the browser.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
target(): Target;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Target](./puppeteer.target.md)
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.targets
|
||||
---
|
||||
|
||||
# Browser.targets() method
|
||||
|
||||
All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
targets(): Target[];
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Target](./puppeteer.target.md)\[\]
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: Browser.userAgent
|
||||
---
|
||||
|
||||
# Browser.userAgent() method
|
||||
|
||||
The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
userAgent(): Promise<string>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<string>
|
@ -0,0 +1,25 @@
|
||||
---
|
||||
sidebar_label: Browser.version
|
||||
---
|
||||
|
||||
# Browser.version() method
|
||||
|
||||
A string representing the browser name and version.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
version(): Promise<string>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<string>
|
||||
|
||||
## Remarks
|
||||
|
||||
For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For non-headless, this is similar to `Chrome/61.0.3153.0`.
|
||||
|
||||
The format of browser.version() might change with future releases of Chromium.
|
@ -0,0 +1,42 @@
|
||||
---
|
||||
sidebar_label: Browser.waitForTarget
|
||||
---
|
||||
|
||||
# Browser.waitForTarget() method
|
||||
|
||||
Searches for a target in all browser contexts.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
waitForTarget(
|
||||
predicate: (x: Target) => boolean | Promise<boolean>,
|
||||
options?: WaitForTargetOptions
|
||||
): Promise<Target>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---------------------------------------------------------------------------- | -------------------------------------- |
|
||||
| predicate | (x: [Target](./puppeteer.target.md)) => boolean \| Promise<boolean> | A function to be run for every target. |
|
||||
| options | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | <i>(Optional)</i> |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Target](./puppeteer.target.md)>
|
||||
|
||||
The first target found that matches the `predicate` function.
|
||||
|
||||
## Example
|
||||
|
||||
An example of finding a target for a page opened via `window.open`:
|
||||
|
||||
```ts
|
||||
await page.evaluate(() => window.open('https://www.example.com/'));
|
||||
const newWindowTarget = await browser.waitForTarget(
|
||||
target => target.url() === 'https://www.example.com/'
|
||||
);
|
||||
```
|
@ -0,0 +1,27 @@
|
||||
---
|
||||
sidebar_label: Browser.wsEndpoint
|
||||
---
|
||||
|
||||
# Browser.wsEndpoint() method
|
||||
|
||||
The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class Browser {
|
||||
wsEndpoint(): string;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
string
|
||||
|
||||
The Browser websocket url.
|
||||
|
||||
## Remarks
|
||||
|
||||
The format is `ws://${host}:${port}/devtools/browser/<id>`.
|
||||
|
||||
You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. Learn more about the [devtools protocol](https://chromedevtools.github.io/devtools-protocol) and the [browser endpoint](https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target).
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserConnectOptions.defaultViewport
|
||||
---
|
||||
|
||||
# BrowserConnectOptions.defaultViewport property
|
||||
|
||||
Sets the viewport for each page.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserConnectOptions {
|
||||
defaultViewport?: Viewport | null;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserConnectOptions.ignoreHTTPSErrors
|
||||
---
|
||||
|
||||
# BrowserConnectOptions.ignoreHTTPSErrors property
|
||||
|
||||
Whether to ignore HTTPS errors during navigation.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserConnectOptions {
|
||||
ignoreHTTPSErrors?: boolean;
|
||||
}
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
sidebar_label: BrowserConnectOptions
|
||||
---
|
||||
|
||||
# BrowserConnectOptions interface
|
||||
|
||||
Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BrowserConnectOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ---------------------------------------------------------------------------- | --------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
||||
| [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | | [Viewport](./puppeteer.viewport.md) \| null | <i>(Optional)</i> Sets the viewport for each page. |
|
||||
| [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | | boolean | <i>(Optional)</i> Whether to ignore HTTPS errors during navigation. |
|
||||
| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | | number | <i>(Optional)</i> Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. |
|
||||
| [targetFilter?](./puppeteer.browserconnectoptions.targetfilter.md) | | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | <i>(Optional)</i> Callback to decide if Puppeteer should connect to a given target or not. |
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserConnectOptions.slowMo
|
||||
---
|
||||
|
||||
# BrowserConnectOptions.slowMo property
|
||||
|
||||
Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserConnectOptions {
|
||||
slowMo?: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserConnectOptions.targetFilter
|
||||
---
|
||||
|
||||
# BrowserConnectOptions.targetFilter property
|
||||
|
||||
Callback to decide if Puppeteer should connect to a given target or not.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserConnectOptions {
|
||||
targetFilter?: TargetFilterCallback;
|
||||
}
|
||||
```
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.browser
|
||||
---
|
||||
|
||||
# BrowserContext.browser() method
|
||||
|
||||
The browser this browser context belongs to.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
browser(): Browser;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Browser](./puppeteer.browser.md)
|
@ -0,0 +1,28 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.clearPermissionOverrides
|
||||
---
|
||||
|
||||
# BrowserContext.clearPermissionOverrides() method
|
||||
|
||||
Clears all permission overrides for the browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
clearPermissionOverrides(): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const context = browser.defaultBrowserContext();
|
||||
context.overridePermissions('https://example.com', ['clipboard-read']);
|
||||
// do stuff ..
|
||||
context.clearPermissionOverrides();
|
||||
```
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.close
|
||||
---
|
||||
|
||||
# BrowserContext.close() method
|
||||
|
||||
Closes the browser context. All the targets that belong to the browser context will be closed.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
close(): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Remarks
|
||||
|
||||
Only incognito browser contexts can be closed.
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.isIncognito
|
||||
---
|
||||
|
||||
# BrowserContext.isIncognito() method
|
||||
|
||||
Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
isIncognito(): boolean;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
boolean
|
||||
|
||||
## Remarks
|
||||
|
||||
The default browser context cannot be closed.
|
@ -0,0 +1,52 @@
|
||||
---
|
||||
sidebar_label: BrowserContext
|
||||
---
|
||||
|
||||
# BrowserContext class
|
||||
|
||||
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](./puppeteer.browser.newpage.md) creates a page in the default browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class BrowserContext extends EventEmitter
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) enum.
|
||||
|
||||
If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context.
|
||||
|
||||
Puppeteer allows creation of "incognito" browser contexts with [Browser.createIncognitoBrowserContext](./puppeteer.browser.createincognitobrowsercontext.md) method. "Incognito" browser contexts don't write any browsing data to disk.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserContext` class.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
// Create a new incognito browser context
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page inside context.
|
||||
const page = await context.newPage();
|
||||
// ... do stuff with page ...
|
||||
await page.goto('https://example.com');
|
||||
// Dispose context once it's no longer needed.
|
||||
await context.close();
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||
| [browser()](./puppeteer.browsercontext.browser.md) | | The browser this browser context belongs to. |
|
||||
| [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for the browser context. |
|
||||
| [close()](./puppeteer.browsercontext.close.md) | | Closes the browser context. All the targets that belong to the browser context will be closed. |
|
||||
| [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context. |
|
||||
| [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new page in the browser context. |
|
||||
| [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | |
|
||||
| [pages()](./puppeteer.browsercontext.pages.md) | | An array of all pages inside the browser context. |
|
||||
| [targets()](./puppeteer.browsercontext.targets.md) | | An array of all active targets inside the browser context. |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md) | | This searches for a target in this specific browser context. |
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.newPage
|
||||
---
|
||||
|
||||
# BrowserContext.newPage() method
|
||||
|
||||
Creates a new page in the browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
newPage(): Promise<Page>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)>
|
@ -0,0 +1,31 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.overridePermissions
|
||||
---
|
||||
|
||||
# BrowserContext.overridePermissions() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
overridePermissions(origin: string, permissions: Permission[]): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ----------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| origin | string | The origin to grant permissions to, e.g. "https://example.com". |
|
||||
| permissions | [Permission](./puppeteer.permission.md)\[\] | An array of permissions to grant. All permissions that are not listed here will be automatically denied. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const context = browser.defaultBrowserContext();
|
||||
await context.overridePermissions('https://html5demos.com', ['geolocation']);
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.pages
|
||||
---
|
||||
|
||||
# BrowserContext.pages() method
|
||||
|
||||
An array of all pages inside the browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
pages(): Promise<Page[]>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)\[\]>
|
||||
|
||||
Promise which resolves to an array of all open pages. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [the target page](./puppeteer.target.page.md).
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.targets
|
||||
---
|
||||
|
||||
# BrowserContext.targets() method
|
||||
|
||||
An array of all active targets inside the browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
targets(): Target[];
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Target](./puppeteer.target.md)\[\]
|
@ -0,0 +1,44 @@
|
||||
---
|
||||
sidebar_label: BrowserContext.waitForTarget
|
||||
---
|
||||
|
||||
# BrowserContext.waitForTarget() method
|
||||
|
||||
This searches for a target in this specific browser context.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserContext {
|
||||
waitForTarget(
|
||||
predicate: (x: Target) => boolean | Promise<boolean>,
|
||||
options?: {
|
||||
timeout?: number;
|
||||
}
|
||||
): Promise<Target>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| predicate | (x: [Target](./puppeteer.target.md)) => boolean \| Promise<boolean> | A function to be run for every target |
|
||||
| options | { timeout?: number; } | <i>(Optional)</i> An object of options. Accepts a timout, which is the maximum wait time in milliseconds. Pass <code>0</code> to disable the timeout. Defaults to 30 seconds. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[Target](./puppeteer.target.md)>
|
||||
|
||||
Promise which resolves to the first target found that matches the `predicate` function.
|
||||
|
||||
## Example
|
||||
|
||||
An example of finding a target for a page opened via `window.open`:
|
||||
|
||||
```ts
|
||||
await page.evaluate(() => window.open('https://www.example.com/'));
|
||||
const newWindowTarget = await browserContext.waitForTarget(
|
||||
target => target.url() === 'https://www.example.com/'
|
||||
);
|
||||
```
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserContextEmittedEvents
|
||||
---
|
||||
|
||||
# BrowserContextEmittedEvents enum
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare const enum BrowserContextEmittedEvents
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
| Member | Value | Description |
|
||||
| --------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| TargetChanged | <code>"targetchanged"</code> | Emitted when the url of a target inside the browser context changes. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetCreated | <code>"targetcreated"</code> | <p>Emitted when a target is created within the browser context, for example when a new page is opened by [window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) or by [browserContext.newPage](./puppeteer.browsercontext.newpage.md)</p><p>Contains a [Target](./puppeteer.target.md) instance.</p> |
|
||||
| TargetDestroyed | <code>"targetdestroyed"</code> | Emitted when a target is destroyed within the browser context, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. |
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
sidebar_label: BrowserContextOptions
|
||||
---
|
||||
|
||||
# BrowserContextOptions interface
|
||||
|
||||
BrowserContext options.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BrowserContextOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ------------------------------------------------------------------------ | --------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [proxyBypassList?](./puppeteer.browsercontextoptions.proxybypasslist.md) | | string\[\] | <i>(Optional)</i> Bypass the proxy for the given semi-colon-separated list of hosts. |
|
||||
| [proxyServer?](./puppeteer.browsercontextoptions.proxyserver.md) | | string | <i>(Optional)</i> Proxy server with optional port to use for all requests. Username and password can be set in <code>Page.authenticate</code>. |
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserContextOptions.proxyBypassList
|
||||
---
|
||||
|
||||
# BrowserContextOptions.proxyBypassList property
|
||||
|
||||
Bypass the proxy for the given semi-colon-separated list of hosts.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserContextOptions {
|
||||
proxyBypassList?: string[];
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserContextOptions.proxyServer
|
||||
---
|
||||
|
||||
# BrowserContextOptions.proxyServer property
|
||||
|
||||
Proxy server with optional port to use for all requests. Username and password can be set in `Page.authenticate`.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserContextOptions {
|
||||
proxyServer?: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
sidebar_label: BrowserEmittedEvents
|
||||
---
|
||||
|
||||
# BrowserEmittedEvents enum
|
||||
|
||||
All the events a [browser instance](./puppeteer.browser.md) may emit.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare const enum BrowserEmittedEvents
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
| Member | Value | Description |
|
||||
| --------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Disconnected | <code>"disconnected"</code> | <p>Emitted when Puppeteer gets disconnected from the Chromium instance. This might happen because of one of the following:</p><p>- Chromium is closed or crashed</p><p>- The [browser.disconnect](./puppeteer.browser.disconnect.md) method was called.</p> |
|
||||
| TargetChanged | <code>"targetchanged"</code> | Emitted when the url of a target changes. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetCreated | <code>"targetcreated"</code> | <p>Emitted when a target is created, for example when a new page is opened by [window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) or by [browser.newPage](./puppeteer.browser.newpage.md)</p><p>Contains a [Target](./puppeteer.target.md) instance.</p> |
|
||||
| TargetDestroyed | <code>"targetdestroyed"</code> | Emitted when a target is destroyed, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. |
|
@ -0,0 +1,31 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.canDownload
|
||||
---
|
||||
|
||||
# BrowserFetcher.canDownload() method
|
||||
|
||||
Initiates a HEAD request to check if the revision is available.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
canDownload(revision: string): Promise<boolean>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | --------------------------------------- |
|
||||
| revision | string | The revision to check availability for. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<boolean>
|
||||
|
||||
A promise that resolves to `true` if the revision could be downloaded from the host.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
@ -0,0 +1,35 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.download
|
||||
---
|
||||
|
||||
# BrowserFetcher.download() method
|
||||
|
||||
Initiates a GET request to download the revision from the host.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
download(
|
||||
revision: string,
|
||||
progressCallback?: (x: number, y: number) => void
|
||||
): Promise<BrowserFetcherRevisionInfo | undefined>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| ---------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| revision | string | The revision to download. |
|
||||
| progressCallback | (x: number, y: number) => void | <i>(Optional)</i> A function that will be called with two arguments: How many bytes have been downloaded and the total number of bytes of the download. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) \| undefined>
|
||||
|
||||
A promise with revision information when the revision is downloaded and extracted.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.host
|
||||
---
|
||||
|
||||
# BrowserFetcher.host() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
host(): string;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
string
|
||||
|
||||
The download host being used.
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.localRevisions
|
||||
---
|
||||
|
||||
# BrowserFetcher.localRevisions() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
localRevisions(): Promise<string[]>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<string\[\]>
|
||||
|
||||
A promise with a list of all revision strings (for the current `product`) available locally on disk.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
@ -0,0 +1,46 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher
|
||||
---
|
||||
|
||||
# BrowserFetcher class
|
||||
|
||||
BrowserFetcher can download and manage different versions of Chromium and Firefox.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class BrowserFetcher
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
BrowserFetcher operates on revision strings that specify a precise version of Chromium, e.g. `"533271"`. Revision strings can be obtained from [omahaproxy.appspot.com](http://omahaproxy.appspot.com/). In the Firefox case, BrowserFetcher downloads Firefox Nightly and operates on version numbers such as `"75"`.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserFetcher` class.
|
||||
|
||||
## Example
|
||||
|
||||
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
|
||||
|
||||
```ts
|
||||
const browserFetcher = puppeteer.createBrowserFetcher();
|
||||
const revisionInfo = await browserFetcher.download('533271');
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: revisionInfo.executablePath,
|
||||
});
|
||||
```
|
||||
|
||||
\*\*NOTE\*\* BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| ------------------------------------------------------------------------------ | --------- | --------------------------------------------------------------- |
|
||||
| [canDownload(revision)](./puppeteer.browserfetcher.candownload.md) | | Initiates a HEAD request to check if the revision is available. |
|
||||
| [download(revision, progressCallback)](./puppeteer.browserfetcher.download.md) | | Initiates a GET request to download the revision from the host. |
|
||||
| [host()](./puppeteer.browserfetcher.host.md) | | |
|
||||
| [localRevisions()](./puppeteer.browserfetcher.localrevisions.md) | | |
|
||||
| [platform()](./puppeteer.browserfetcher.platform.md) | | |
|
||||
| [product()](./puppeteer.browserfetcher.product.md) | | |
|
||||
| [remove(revision)](./puppeteer.browserfetcher.remove.md) | | |
|
||||
| [revisionInfo(revision)](./puppeteer.browserfetcher.revisioninfo.md) | | |
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.platform
|
||||
---
|
||||
|
||||
# BrowserFetcher.platform() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
platform(): Platform;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Platform](./puppeteer.platform.md)
|
||||
|
||||
Returns the current `Platform`, which is one of `mac`, `linux`, `win32` or `win64`.
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.product
|
||||
---
|
||||
|
||||
# BrowserFetcher.product() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
product(): Product;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Product](./puppeteer.product.md)
|
||||
|
||||
Returns the current `Product`, which is one of `chrome` or `firefox`.
|
@ -0,0 +1,29 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.remove
|
||||
---
|
||||
|
||||
# BrowserFetcher.remove() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
remove(revision: string): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | ---------------------------------------------------------- |
|
||||
| revision | string | A revision to remove for the current <code>product</code>. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
||||
|
||||
A promise that resolves when the revision has been removes or throws if the revision has not been downloaded.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
@ -0,0 +1,25 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcher.revisionInfo
|
||||
---
|
||||
|
||||
# BrowserFetcher.revisionInfo() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class BrowserFetcher {
|
||||
revisionInfo(revision: string): BrowserFetcherRevisionInfo;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ------ | ----------------------------- |
|
||||
| revision | string | The revision to get info for. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)
|
||||
|
||||
The revision info for the given revision.
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherOptions.host
|
||||
---
|
||||
|
||||
# BrowserFetcherOptions.host property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherOptions {
|
||||
host?: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherOptions
|
||||
---
|
||||
|
||||
# BrowserFetcherOptions interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BrowserFetcherOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ---------------------------------------------------------- | --------- | ----------------------------------- | ----------------- |
|
||||
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> |
|
||||
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> |
|
||||
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> |
|
||||
| [product?](./puppeteer.browserfetcheroptions.product.md) | | string | <i>(Optional)</i> |
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherOptions.path
|
||||
---
|
||||
|
||||
# BrowserFetcherOptions.path property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherOptions {
|
||||
path?: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherOptions.platform
|
||||
---
|
||||
|
||||
# BrowserFetcherOptions.platform property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherOptions {
|
||||
platform?: Platform;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherOptions.product
|
||||
---
|
||||
|
||||
# BrowserFetcherOptions.product property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherOptions {
|
||||
product?: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.executablePath
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.executablePath property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
executablePath: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.folderPath
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.folderPath property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
folderPath: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.local
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.local property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
local: boolean;
|
||||
}
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BrowserFetcherRevisionInfo
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| -------------------------------------------------------------------------- | --------- | ------- | ----------- |
|
||||
| [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md) | | string | |
|
||||
| [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md) | | string | |
|
||||
| [local](./puppeteer.browserfetcherrevisioninfo.local.md) | | boolean | |
|
||||
| [product](./puppeteer.browserfetcherrevisioninfo.product.md) | | string | |
|
||||
| [revision](./puppeteer.browserfetcherrevisioninfo.revision.md) | | string | |
|
||||
| [url](./puppeteer.browserfetcherrevisioninfo.url.md) | | string | |
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.product
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.product property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
product: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.revision
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.revision property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
revision: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserFetcherRevisionInfo.url
|
||||
---
|
||||
|
||||
# BrowserFetcherRevisionInfo.url property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserFetcherRevisionInfo {
|
||||
url: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions.args
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions.args property
|
||||
|
||||
Additional command line arguments to pass to the browser instance.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserLaunchArgumentOptions {
|
||||
args?: string[];
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions.debuggingPort
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions.debuggingPort property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserLaunchArgumentOptions {
|
||||
debuggingPort?: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions.devtools
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions.devtools property
|
||||
|
||||
Whether to auto-open a DevTools panel for each tab. If this is set to `true`, then `headless` will be forced to `false`.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserLaunchArgumentOptions {
|
||||
devtools?: boolean;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions.headless
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions.headless property
|
||||
|
||||
Whether to run the browser in headless mode.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserLaunchArgumentOptions {
|
||||
headless?: boolean | 'chrome';
|
||||
}
|
||||
```
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions interface
|
||||
|
||||
Launcher options that only apply to Chrome.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface BrowserLaunchArgumentOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --------------------------------------------------------------------------- | --------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [args?](./puppeteer.browserlaunchargumentoptions.args.md) | | string\[\] | <i>(Optional)</i> Additional command line arguments to pass to the browser instance. |
|
||||
| [debuggingPort?](./puppeteer.browserlaunchargumentoptions.debuggingport.md) | | number | <i>(Optional)</i> |
|
||||
| [devtools?](./puppeteer.browserlaunchargumentoptions.devtools.md) | | boolean | <i>(Optional)</i> Whether to auto-open a DevTools panel for each tab. If this is set to <code>true</code>, then <code>headless</code> will be forced to <code>false</code>. |
|
||||
| [headless?](./puppeteer.browserlaunchargumentoptions.headless.md) | | boolean \| 'chrome' | <i>(Optional)</i> Whether to run the browser in headless mode. |
|
||||
| [userDataDir?](./puppeteer.browserlaunchargumentoptions.userdatadir.md) | | string | <i>(Optional)</i> Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. |
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: BrowserLaunchArgumentOptions.userDataDir
|
||||
---
|
||||
|
||||
# BrowserLaunchArgumentOptions.userDataDir property
|
||||
|
||||
Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface BrowserLaunchArgumentOptions {
|
||||
userDataDir?: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
---
|
||||
sidebar_label: CDPSession.connection
|
||||
---
|
||||
|
||||
# CDPSession.connection() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class CDPSession {
|
||||
connection(): Connection | undefined;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
[Connection](./puppeteer.connection.md) \| undefined
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: CDPSession.detach
|
||||
---
|
||||
|
||||
# CDPSession.detach() method
|
||||
|
||||
Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class CDPSession {
|
||||
detach(): Promise<void>;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<void>
|
@ -0,0 +1,19 @@
|
||||
---
|
||||
sidebar_label: CDPSession.id
|
||||
---
|
||||
|
||||
# CDPSession.id() method
|
||||
|
||||
Returns the session's id.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class CDPSession {
|
||||
id(): string;
|
||||
}
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
string
|
@ -0,0 +1,47 @@
|
||||
---
|
||||
sidebar_label: CDPSession
|
||||
---
|
||||
|
||||
# CDPSession class
|
||||
|
||||
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare class CDPSession extends EventEmitter
|
||||
```
|
||||
|
||||
**Extends:** [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
Protocol methods can be called with [CDPSession.send()](./puppeteer.cdpsession.send.md) method and protocol events can be subscribed to with `CDPSession.on` method.
|
||||
|
||||
Useful links: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/) and [Getting Started with DevTools Protocol](https://github.com/aslushnikov/getting-started-with-cdp/blob/HEAD/README.md).
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `CDPSession` class.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const client = await page.target().createCDPSession();
|
||||
await client.send('Animation.enable');
|
||||
client.on('Animation.animationCreated', () =>
|
||||
console.log('Animation created!')
|
||||
);
|
||||
const response = await client.send('Animation.getPlaybackRate');
|
||||
console.log('playback rate is ' + response.playbackRate);
|
||||
await client.send('Animation.setPlaybackRate', {
|
||||
playbackRate: response.playbackRate / 2,
|
||||
});
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [connection()](./puppeteer.cdpsession.connection.md) | | |
|
||||
| [detach()](./puppeteer.cdpsession.detach.md) | | Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages. |
|
||||
| [id()](./puppeteer.cdpsession.id.md) | | Returns the session's id. |
|
||||
| [send(method, paramArgs)](./puppeteer.cdpsession.send.md) | | |
|
@ -0,0 +1,27 @@
|
||||
---
|
||||
sidebar_label: CDPSession.send
|
||||
---
|
||||
|
||||
# CDPSession.send() method
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
class CDPSession {
|
||||
send<T extends keyof ProtocolMapping.Commands>(
|
||||
method: T,
|
||||
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
||||
): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | --------------------------------------------- | ----------- |
|
||||
| method | T | |
|
||||
| paramArgs | ProtocolMapping.Commands\[T\]\['paramsType'\] | |
|
||||
|
||||
**Returns:**
|
||||
|
||||
Promise<ProtocolMapping.Commands\[T\]\['returnType'\]>
|
@ -0,0 +1,17 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject.error
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject.error property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface CDPSessionOnMessageObject {
|
||||
error: {
|
||||
message: string;
|
||||
data: any;
|
||||
code: number;
|
||||
};
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject.id
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject.id property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface CDPSessionOnMessageObject {
|
||||
id?: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface CDPSessionOnMessageObject
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ---------------------------------------------------------- | --------- | --------------------------------------------- | ----------------- |
|
||||
| [error](./puppeteer.cdpsessiononmessageobject.error.md) | | { message: string; data: any; code: number; } | |
|
||||
| [id?](./puppeteer.cdpsessiononmessageobject.id.md) | | number | <i>(Optional)</i> |
|
||||
| [method](./puppeteer.cdpsessiononmessageobject.method.md) | | string | |
|
||||
| [params](./puppeteer.cdpsessiononmessageobject.params.md) | | Record<string, unknown> | |
|
||||
| [result?](./puppeteer.cdpsessiononmessageobject.result.md) | | any | <i>(Optional)</i> |
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject.method
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject.method property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface CDPSessionOnMessageObject {
|
||||
method: string;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject.params
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject.params property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface CDPSessionOnMessageObject {
|
||||
params: Record<string, unknown>;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: CDPSessionOnMessageObject.result
|
||||
---
|
||||
|
||||
# CDPSessionOnMessageObject.result property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface CDPSessionOnMessageObject {
|
||||
result?: any;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: ChromeReleaseChannel
|
||||
---
|
||||
|
||||
# ChromeReleaseChannel type
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare type ChromeReleaseChannel =
|
||||
| 'chrome'
|
||||
| 'chrome-beta'
|
||||
| 'chrome-canary'
|
||||
| 'chrome-dev';
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
---
|
||||
sidebar_label: clearCustomQueryHandlers
|
||||
---
|
||||
|
||||
# clearCustomQueryHandlers() function
|
||||
|
||||
Clears all registered handlers.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export declare function clearCustomQueryHandlers(): void;
|
||||
```
|
||||
|
||||
**Returns:**
|
||||
|
||||
void
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: ClickOptions.button
|
||||
---
|
||||
|
||||
# ClickOptions.button property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface ClickOptions {
|
||||
button?: MouseButton;
|
||||
}
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
sidebar_label: ClickOptions.clickCount
|
||||
---
|
||||
|
||||
# ClickOptions.clickCount property
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface ClickOptions {
|
||||
clickCount?: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
sidebar_label: ClickOptions.delay
|
||||
---
|
||||
|
||||
# ClickOptions.delay property
|
||||
|
||||
Time to wait between `mousedown` and `mouseup` in milliseconds.
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
interface ClickOptions {
|
||||
delay?: number;
|
||||
}
|
||||
```
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
sidebar_label: ClickOptions
|
||||
---
|
||||
|
||||
# ClickOptions interface
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
export interface ClickOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| ----------------------------------------------------- | --------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
||||
| [button?](./puppeteer.clickoptions.button.md) | | [MouseButton](./puppeteer.mousebutton.md) | <i>(Optional)</i> |
|
||||
| [clickCount?](./puppeteer.clickoptions.clickcount.md) | | number | <i>(Optional)</i> |
|
||||
| [delay?](./puppeteer.clickoptions.delay.md) | | number | <i>(Optional)</i> Time to wait between <code>mousedown</code> and <code>mouseup</code> in milliseconds. |
|
||||
| [offset?](./puppeteer.clickoptions.offset.md) | | [Offset](./puppeteer.offset.md) | <i>(Optional)</i> Offset for the clickable point relative to the top-left corder of the border box. |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user