chore: format docs (#8629)

This commit is contained in:
jrandolf 2022-07-05 15:41:43 +02:00 committed by GitHub
parent 9e596d0761
commit b5a345b06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
726 changed files with 17463 additions and 15301 deletions

View File

@ -1,6 +1,3 @@
<!-- docusaurus-metadata-start -->
<!-- docusaurus-metadata-end -->
# Puppeteer # Puppeteer
<!-- [START badges] --> <!-- [START badges] -->

View File

@ -1,166 +1,166 @@
--- ---
sidebar_label: API sidebar_label: API
--- ---
# API Reference
# API Reference
## Classes
## Classes
| Class | Description |
| --- | --- | | 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). | | [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). |
| [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. | | [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). |
| [BrowserFetcher](./puppeteer.browserfetcher.md) | BrowserFetcher can download and manage different versions of Chromium and Firefox. | | [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. |
| [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. | | [BrowserFetcher](./puppeteer.browserfetcher.md) | BrowserFetcher can download and manage different versions of Chromium and Firefox. |
| [Connection](./puppeteer.connection.md) | | | [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. |
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. | | [Connection](./puppeteer.connection.md) | |
| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. | | [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
| [CSSCoverage](./puppeteer.csscoverage.md) | | | [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gathers information about parts of JavaScript and CSS that were used by the page. |
| [CustomError](./puppeteer.customerror.md) | | | [CSSCoverage](./puppeteer.csscoverage.md) | |
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. | | [CustomError](./puppeteer.customerror.md) | |
| [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. | | [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
| [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. | | [ElementHandle](./puppeteer.elementhandle.md) | ElementHandle represents an in-page DOM element. |
| [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> | | [EventEmitter](./puppeteer.eventemitter.md) | The EventEmitter class that many Puppeteer classes extend. |
| [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. | | [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> |
| [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. | | [FileChooser](./puppeteer.filechooser.md) | File choosers let you react to the page requesting for a file. |
| [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. | | [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. |
| [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. | | [HTTPRequest](./puppeteer.httprequest.md) | Represents an HTTP request sent by a page. |
| [JSCoverage](./puppeteer.jscoverage.md) | | | [HTTPResponse](./puppeteer.httpresponse.md) | The HTTPResponse class represents responses which are received by the [Page](./puppeteer.page.md) class. |
| [JSHandle](./puppeteer.jshandle.md) | Represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle](./puppeteer.page.evaluatehandle.md) method. | | [JSCoverage](./puppeteer.jscoverage.md) | |
| [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. | | [JSHandle](./puppeteer.jshandle.md) | Represents an in-page JavaScript object. JSHandles can be created with the [page.evaluateHandle](./puppeteer.page.evaluatehandle.md) method. |
| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. | | [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. |
| [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> | | [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. |
| [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. | | [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> |
| [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> | | [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. |
| [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> | | [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> |
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. | | [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> |
| [Target](./puppeteer.target.md) | | | [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. | | [Target](./puppeteer.target.md) | |
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. | | [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. | | [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). | | [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
## Enumerations
| Enumeration | Description |
| --- | --- | | Enumeration | Description |
| [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) | | | ------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. | | [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) | |
| [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | | | [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) | All the events a [browser instance](./puppeteer.browser.md) may emit. |
| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. | | [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) | |
| [PageEmittedEvents](./puppeteer.pageemittedevents.md) | All the events that a page instance may emit. |
## Functions
## Functions
| Function | Description |
| --- | --- | | Function | Description |
| [clearCustomQueryHandlers()](./puppeteer.clearcustomqueryhandlers.md) | Clears all registered handlers. | | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| [customQueryHandlerNames()](./puppeteer.customqueryhandlernames.md) | | | [clearCustomQueryHandlers()](./puppeteer.clearcustomqueryhandlers.md) | Clears all registered handlers. |
| [registerCustomQueryHandler(name, handler)](./puppeteer.registercustomqueryhandler.md) | Registers a [custom query handler](./puppeteer.customqueryhandler.md). | | [customQueryHandlerNames()](./puppeteer.customqueryhandlernames.md) | |
| [unregisterCustomQueryHandler(name)](./puppeteer.unregistercustomqueryhandler.md) | | | [registerCustomQueryHandler(name, handler)](./puppeteer.registercustomqueryhandler.md) | Registers a [custom query handler](./puppeteer.customqueryhandler.md). |
| [unregisterCustomQueryHandler(name)](./puppeteer.unregistercustomqueryhandler.md) | |
## Interfaces
## Interfaces
| Interface | Description |
| --- | --- | | Interface | Description |
| [BoundingBox](./puppeteer.boundingbox.md) | | | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [BoxModel](./puppeteer.boxmodel.md) | | | [BoundingBox](./puppeteer.boundingbox.md) | |
| [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. | | [BoxModel](./puppeteer.boxmodel.md) | |
| [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. | | [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) | Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance. |
| [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | | | [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | BrowserContext options. |
| [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) | | | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
| [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. | | [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) | |
| [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | | | [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) | Launcher options that only apply to Chrome. |
| [ClickOptions](./puppeteer.clickoptions.md) | | | [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | |
| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | | | [ClickOptions](./puppeteer.clickoptions.md) | |
| [ConnectionCallback](./puppeteer.connectioncallback.md) | | | [CommonEventEmitter](./puppeteer.commoneventemitter.md) | |
| [ConnectionTransport](./puppeteer.connectiontransport.md) | | | [ConnectionCallback](./puppeteer.connectioncallback.md) | |
| [ConnectOptions](./puppeteer.connectoptions.md) | | | [ConnectionTransport](./puppeteer.connectiontransport.md) | |
| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | | | [ConnectOptions](./puppeteer.connectoptions.md) | |
| [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | | | [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | |
| [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. | | [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | |
| [Credentials](./puppeteer.credentials.md) | | | [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. |
| [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. | | [Credentials](./puppeteer.credentials.md) | |
| [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&lt;Element&gt;</code> or <code>Array&lt;Element&gt;</code> with all the elements that match the given query selector. | | [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. |
| [Device](./puppeteer.device.md) | | | [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&lt;Element&gt;</code> or <code>Array&lt;Element&gt;</code> with all the elements that match the given query selector. |
| [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | | | [Device](./puppeteer.device.md) | |
| [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | | | [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | |
| [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | | | [FrameAddStyleTagOptions](./puppeteer.frameaddstyletagoptions.md) | |
| [GeolocationOptions](./puppeteer.geolocationoptions.md) | | | [FrameWaitForFunctionOptions](./puppeteer.framewaitforfunctionoptions.md) | |
| [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) | | | [GeolocationOptions](./puppeteer.geolocationoptions.md) | |
| [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | | | [InterceptResolutionState](./puppeteer.interceptresolutionstate.md) | |
| [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript | | [InternalNetworkConditions](./puppeteer.internalnetworkconditions.md) | |
| [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. | | [JSCoverageEntry](./puppeteer.jscoverageentry.md) | The CoverageEntry class for JavaScript |
| [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. | | [JSCoverageOptions](./puppeteer.jscoverageoptions.md) | Set of configurable options for JS coverage. |
| [MediaFeature](./puppeteer.mediafeature.md) | | | [LaunchOptions](./puppeteer.launchoptions.md) | Generic launch options that can be passed when launching any browser. |
| [Metrics](./puppeteer.metrics.md) | | | [MediaFeature](./puppeteer.mediafeature.md) | |
| [MouseOptions](./puppeteer.mouseoptions.md) | | | [Metrics](./puppeteer.metrics.md) | |
| [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | | | [MouseOptions](./puppeteer.mouseoptions.md) | |
| [NetworkConditions](./puppeteer.networkconditions.md) | | | [MouseWheelOptions](./puppeteer.mousewheeloptions.md) | |
| [Offset](./puppeteer.offset.md) | | | [NetworkConditions](./puppeteer.networkconditions.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> | | [Offset](./puppeteer.offset.md) | |
| [PDFMargin](./puppeteer.pdfmargin.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> |
| [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). | | [PDFMargin](./puppeteer.pdfmargin.md) | |
| [Point](./puppeteer.point.md) | | | [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). |
| [PressOptions](./puppeteer.pressoptions.md) | | | [Point](./puppeteer.point.md) | |
| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. | | [PressOptions](./puppeteer.pressoptions.md) | |
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | | | [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. |
| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | | | [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
| [RemoteAddress](./puppeteer.remoteaddress.md) | | | [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | |
| [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. | | [RemoteAddress](./puppeteer.remoteaddress.md) | |
| [ScreenshotClip](./puppeteer.screenshotclip.md) | | | [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. |
| [ScreenshotOptions](./puppeteer.screenshotoptions.md) | | | [ScreenshotClip](./puppeteer.screenshotclip.md) | |
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. | | [ScreenshotOptions](./puppeteer.screenshotoptions.md) | |
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | | | [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
| [TracingOptions](./puppeteer.tracingoptions.md) | | | [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
| [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. | | [TracingOptions](./puppeteer.tracingoptions.md) | |
| [WaitForOptions](./puppeteer.waitforoptions.md) | | | [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. |
| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | | | [WaitForOptions](./puppeteer.waitforoptions.md) | |
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | | | [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | |
| [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | | | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
| [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | |
## Variables
## Variables
| Variable | Description |
| --- | --- | | Variable | Description |
| [connect](./puppeteer.connect.md) | | | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [createBrowserFetcher](./puppeteer.createbrowserfetcher.md) | | | [connect](./puppeteer.connect.md) | |
| [DEFAULT\_INTERCEPT\_RESOLUTION\_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority | | [createBrowserFetcher](./puppeteer.createbrowserfetcher.md) | |
| [defaultArgs](./puppeteer.defaultargs.md) | | | [DEFAULT_INTERCEPT_RESOLUTION_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority |
| [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). | | [defaultArgs](./puppeteer.defaultargs.md) | |
| [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> | | [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). |
| [EVALUATION\_SCRIPT\_URL](./puppeteer.evaluation_script_url.md) | | | [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> |
| [executablePath](./puppeteer.executablepath.md) | | | [EVALUATION_SCRIPT_URL](./puppeteer.evaluation_script_url.md) | |
| [launch](./puppeteer.launch.md) | | | [executablePath](./puppeteer.executablepath.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). | | [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 Aliases
| Type Alias | Description |
| --- | --- | | Type Alias | Description |
| [ActionResult](./puppeteer.actionresult.md) | | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Awaitable](./puppeteer.awaitable.md) | | | [ActionResult](./puppeteer.actionresult.md) | |
| [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | | | [Awaitable](./puppeteer.awaitable.md) | |
| [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. | | [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | |
| [DevicesMap](./puppeteer.devicesmap.md) | | | [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. |
| [ErrorCode](./puppeteer.errorcode.md) | | | [DevicesMap](./puppeteer.devicesmap.md) | |
| [EvaluateFunc](./puppeteer.evaluatefunc.md) | | | [ErrorCode](./puppeteer.errorcode.md) | |
| [EventType](./puppeteer.eventtype.md) | | | [EvaluateFunc](./puppeteer.evaluatefunc.md) | |
| [FlattenHandle](./puppeteer.flattenhandle.md) | | | [EventType](./puppeteer.eventtype.md) | |
| [HandleFor](./puppeteer.handlefor.md) | | | [FlattenHandle](./puppeteer.flattenhandle.md) | |
| [HandleOr](./puppeteer.handleor.md) | | | [HandleFor](./puppeteer.handlefor.md) | |
| [Handler](./puppeteer.handler.md) | | | [HandleOr](./puppeteer.handleor.md) | |
| [InnerParams](./puppeteer.innerparams.md) | | | [Handler](./puppeteer.handler.md) | |
| [InterceptResolutionStrategy](./puppeteer.interceptresolutionstrategy.md) | | | [InnerParams](./puppeteer.innerparams.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) | | [InterceptResolutionStrategy](./puppeteer.interceptresolutionstrategy.md) | |
| [LowerCasePaperFormat](./puppeteer.lowercasepaperformat.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) |
| [MouseButton](./puppeteer.mousebutton.md) | | | [LowerCasePaperFormat](./puppeteer.lowercasepaperformat.md) | |
| [PaperFormat](./puppeteer.paperformat.md) | All the valid paper format types when printing a PDF. | | [MouseButton](./puppeteer.mousebutton.md) | |
| [Permission](./puppeteer.permission.md) | | | [PaperFormat](./puppeteer.paperformat.md) | All the valid paper format types when printing a PDF. |
| [Platform](./puppeteer.platform.md) | Supported platforms. | | [Permission](./puppeteer.permission.md) | |
| [Product](./puppeteer.product.md) | Supported products. | | [Platform](./puppeteer.platform.md) | Supported platforms. |
| [ProtocolLifeCycleEvent](./puppeteer.protocollifecycleevent.md) | | | [Product](./puppeteer.product.md) | Supported products. |
| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | | | [ProtocolLifeCycleEvent](./puppeteer.protocollifecycleevent.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. | | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | |
| [ResourceType](./puppeteer.resourcetype.md) | Resource types for HTTPRequests as perceived by the rendering engine. | | [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. |
| [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | | | [ResourceType](./puppeteer.resourcetype.md) | Resource types for HTTPRequests as perceived by the rendering engine. |
| [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | |

View File

@ -1,29 +1,29 @@
--- ---
sidebar_label: Accessibility sidebar_label: Accessibility
--- ---
# Accessibility class
# 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).
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:**
**Signature:**
```typescript
export declare class Accessibility ```typescript
``` export declare class Accessibility
```
## Remarks
## Remarks
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.
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.
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.
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.
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
## Methods
| Method | Modifiers | Description |
| --- | --- | --- | | 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. | | ---------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| [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. |

View File

@ -1,58 +1,59 @@
--- ---
sidebar_label: Accessibility.snapshot sidebar_label: Accessibility.snapshot
--- ---
# Accessibility.snapshot() method
# Accessibility.snapshot() method
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
**Signature:**
**Signature:**
```typescript
class Accessibility {snapshot(options?: SnapshotOptions): Promise<SerializedAXNode | null>;} ```typescript
``` class Accessibility {
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode | null>;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | <i>(Optional)</i> |
| Parameter | Type | Description |
**Returns:** | --------- | ------------------------------------------------- | ----------------- |
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | <i>(Optional)</i> |
Promise&lt;[SerializedAXNode](./puppeteer.serializedaxnode.md) \| null&gt;
**Returns:**
An AXNode object representing the snapshot.
Promise&lt;[SerializedAXNode](./puppeteer.serializedaxnode.md) \| null&gt;
## Remarks
An AXNode object representing the snapshot.
\*\*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`.
## Remarks
## Example 1
\*\*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`.
An example of dumping the entire accessibility tree:
## Example 1
```ts
const snapshot = await page.accessibility.snapshot(); An example of dumping the entire accessibility tree:
console.log(snapshot);
``` ```ts
const snapshot = await page.accessibility.snapshot();
## Example 2 console.log(snapshot);
```
An example of logging the focused node's name:
## Example 2
```ts
const snapshot = await page.accessibility.snapshot(); An example of logging the focused node's name:
const node = findFocusedNode(snapshot);
console.log(node && node.name); ```ts
const snapshot = await page.accessibility.snapshot();
function findFocusedNode(node) { const node = findFocusedNode(snapshot);
if (node.focused) console.log(node && node.name);
return node;
for (const child of node.children || []) { function findFocusedNode(node) {
const foundNode = findFocusedNode(child); if (node.focused) return node;
return foundNode; for (const child of node.children || []) {
} const foundNode = findFocusedNode(child);
return null; return foundNode;
} }
``` return null;
}
```

View File

@ -1,11 +1,11 @@
--- ---
sidebar_label: ActionResult sidebar_label: ActionResult
--- ---
# ActionResult type
# ActionResult type
**Signature:** **Signature:**
```typescript ```typescript
export declare type ActionResult = 'continue' | 'abort' | 'respond'; export declare type ActionResult = 'continue' | 'abort' | 'respond';
``` ```

View File

@ -1,11 +1,11 @@
--- ---
sidebar_label: Awaitable sidebar_label: Awaitable
--- ---
# Awaitable type
# Awaitable type
**Signature:** **Signature:**
```typescript ```typescript
export declare type Awaitable<T> = T | PromiseLike<T>; export declare type Awaitable<T> = T | PromiseLike<T>;
``` ```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BoundingBox.height sidebar_label: BoundingBox.height
--- ---
# BoundingBox.height property
# BoundingBox.height property
the height of the element in pixels.
the height of the element in pixels.
**Signature:**
**Signature:**
```typescript
interface BoundingBox {height: number;} ```typescript
``` interface BoundingBox {
height: number;
}
```

View File

@ -1,20 +1,20 @@
--- ---
sidebar_label: BoundingBox sidebar_label: BoundingBox
--- ---
# BoundingBox interface
# BoundingBox interface
**Signature:** **Signature:**
```typescript ```typescript
export interface BoundingBox extends Point export interface BoundingBox extends Point
``` ```
**Extends:** [Point](./puppeteer.point.md)
**Extends:** [Point](./puppeteer.point.md)
## Properties
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | 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. | | [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. |

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BoundingBox.width sidebar_label: BoundingBox.width
--- ---
# BoundingBox.width property
# BoundingBox.width property
the width of the element in pixels.
the width of the element in pixels.
**Signature:**
**Signature:**
```typescript
interface BoundingBox {width: number;} ```typescript
``` interface BoundingBox {
width: number;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.border sidebar_label: BoxModel.border
--- ---
# BoxModel.border property
# BoxModel.border property
**Signature:**
**Signature:**
```typescript
interface BoxModel {border: Point[];} ```typescript
``` interface BoxModel {
border: Point[];
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.content sidebar_label: BoxModel.content
--- ---
# BoxModel.content property
# BoxModel.content property
**Signature:**
**Signature:**
```typescript
interface BoxModel {content: Point[];} ```typescript
``` interface BoxModel {
content: Point[];
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.height sidebar_label: BoxModel.height
--- ---
# BoxModel.height property
# BoxModel.height property
**Signature:**
**Signature:**
```typescript
interface BoxModel {height: number;} ```typescript
``` interface BoxModel {
height: number;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.margin sidebar_label: BoxModel.margin
--- ---
# BoxModel.margin property
# BoxModel.margin property
**Signature:**
**Signature:**
```typescript
interface BoxModel {margin: Point[];} ```typescript
``` interface BoxModel {
margin: Point[];
}
```

View File

@ -1,23 +1,22 @@
--- ---
sidebar_label: BoxModel sidebar_label: BoxModel
--- ---
# BoxModel interface
# BoxModel interface
**Signature:** **Signature:**
```typescript ```typescript
export interface BoxModel export interface BoxModel
``` ```
## Properties ## Properties
| Property | Modifiers | Type | Description | | Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | ------------------------------------------ | --------- | --------------------------------- | ----------- |
| [border](./puppeteer.boxmodel.border.md) | | [Point](./puppeteer.point.md)\[\] | | | [border](./puppeteer.boxmodel.border.md) | | [Point](./puppeteer.point.md)\[\] | |
| [content](./puppeteer.boxmodel.content.md) | | [Point](./puppeteer.point.md)\[\] | | | [content](./puppeteer.boxmodel.content.md) | | [Point](./puppeteer.point.md)\[\] | |
| [height](./puppeteer.boxmodel.height.md) | | number | | | [height](./puppeteer.boxmodel.height.md) | | number | |
| [margin](./puppeteer.boxmodel.margin.md) | | [Point](./puppeteer.point.md)\[\] | | | [margin](./puppeteer.boxmodel.margin.md) | | [Point](./puppeteer.point.md)\[\] | |
| [padding](./puppeteer.boxmodel.padding.md) | | [Point](./puppeteer.point.md)\[\] | | | [padding](./puppeteer.boxmodel.padding.md) | | [Point](./puppeteer.point.md)\[\] | |
| [width](./puppeteer.boxmodel.width.md) | | number | | | [width](./puppeteer.boxmodel.width.md) | | number | |

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.padding sidebar_label: BoxModel.padding
--- ---
# BoxModel.padding property
# BoxModel.padding property
**Signature:**
**Signature:**
```typescript
interface BoxModel {padding: Point[];} ```typescript
``` interface BoxModel {
padding: Point[];
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BoxModel.width sidebar_label: BoxModel.width
--- ---
# BoxModel.width property
# BoxModel.width property
**Signature:**
**Signature:**
```typescript
interface BoxModel {width: number;} ```typescript
``` interface BoxModel {
width: number;
}
```

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.browserContexts sidebar_label: Browser.browserContexts
--- ---
# Browser.browserContexts() method
# 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).
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:**
**Signature:**
```typescript
class Browser {browserContexts(): BrowserContext[];} ```typescript
``` class Browser {
**Returns:** browserContexts(): BrowserContext[];
}
[BrowserContext](./puppeteer.browsercontext.md)\[\] ```
**Returns:**
[BrowserContext](./puppeteer.browsercontext.md)\[\]

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.close sidebar_label: Browser.close
--- ---
# Browser.close() method
# 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.
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:**
**Signature:**
```typescript
class Browser {close(): Promise<void>;} ```typescript
``` class Browser {
**Returns:** close(): Promise<void>;
}
Promise&lt;void&gt; ```
**Returns:**
Promise&lt;void&gt;

View File

@ -1,38 +1,41 @@
--- ---
sidebar_label: Browser.createIncognitoBrowserContext sidebar_label: Browser.createIncognitoBrowserContext
--- ---
# Browser.createIncognitoBrowserContext() method
# Browser.createIncognitoBrowserContext() method
Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
**Signature:**
**Signature:**
```typescript
class Browser {createIncognitoBrowserContext(options?: BrowserContextOptions): Promise<BrowserContext>;} ```typescript
``` class Browser {
createIncognitoBrowserContext(
## Parameters options?: BrowserContextOptions
): Promise<BrowserContext>;
| Parameter | Type | Description | }
| --- | --- | --- | ```
| options | [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | <i>(Optional)</i> |
## Parameters
**Returns:**
| Parameter | Type | Description |
Promise&lt;[BrowserContext](./puppeteer.browsercontext.md)&gt; | --------- | ------------------------------------------------------------- | ----------------- |
| options | [BrowserContextOptions](./puppeteer.browsercontextoptions.md) | <i>(Optional)</i> |
## Example
**Returns:**
```ts Promise&lt;[BrowserContext](./puppeteer.browsercontext.md)&gt;
(async () => {
const browser = await puppeteer.launch(); ## Example
// Create a new incognito browser context.
const context = await browser.createIncognitoBrowserContext(); ```ts
// Create a new page in a pristine context. (async () => {
const page = await context.newPage(); const browser = await puppeteer.launch();
// Do stuff // Create a new incognito browser context.
await page.goto('https://example.com'); 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');
})();
```

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.defaultBrowserContext sidebar_label: Browser.defaultBrowserContext
--- ---
# Browser.defaultBrowserContext() method
# Browser.defaultBrowserContext() method
Returns the default browser context. The default browser context cannot be closed.
Returns the default browser context. The default browser context cannot be closed.
**Signature:**
**Signature:**
```typescript
class Browser {defaultBrowserContext(): BrowserContext;} ```typescript
``` class Browser {
**Returns:** defaultBrowserContext(): BrowserContext;
}
[BrowserContext](./puppeteer.browsercontext.md) ```
**Returns:**
[BrowserContext](./puppeteer.browsercontext.md)

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.disconnect sidebar_label: Browser.disconnect
--- ---
# Browser.disconnect() method
# 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.
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:**
**Signature:**
```typescript
class Browser {disconnect(): void;} ```typescript
``` class Browser {
**Returns:** disconnect(): void;
}
void ```
**Returns:**
void

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.isConnected sidebar_label: Browser.isConnected
--- ---
# Browser.isConnected() method
# Browser.isConnected() method
Indicates that the browser is connected.
Indicates that the browser is connected.
**Signature:**
**Signature:**
```typescript
class Browser {isConnected(): boolean;} ```typescript
``` class Browser {
**Returns:** isConnected(): boolean;
}
boolean ```
**Returns:**
boolean

View File

@ -1,76 +1,77 @@
--- ---
sidebar_label: Browser sidebar_label: Browser
--- ---
# Browser class
# 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).
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:**
**Signature:**
```typescript
export declare class Browser extends EventEmitter ```typescript
``` export declare class Browser extends EventEmitter
**Extends:** [EventEmitter](./puppeteer.eventemitter.md) ```
## Remarks **Extends:** [EventEmitter](./puppeteer.eventemitter.md)
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. ## Remarks
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. 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.
## Example 1 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.
An example of using a [Browser](./puppeteer.browser.md) to create a [Page](./puppeteer.page.md): ## Example 1
```ts An example of using a [Browser](./puppeteer.browser.md) to create a [Page](./puppeteer.page.md):
const puppeteer = require('puppeteer');
```ts
(async () => { const puppeteer = require('puppeteer');
const browser = await puppeteer.launch();
const page = await browser.newPage(); (async () => {
await page.goto('https://example.com'); const browser = await puppeteer.launch();
await browser.close(); 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): ## Example 2
```ts An example of disconnecting from and reconnecting to a [Browser](./puppeteer.browser.md):
const puppeteer = require('puppeteer');
```ts
(async () => { const puppeteer = require('puppeteer');
const browser = await puppeteer.launch();
// Store the endpoint to be able to reconnect to Chromium (async () => {
const browserWSEndpoint = browser.wsEndpoint(); const browser = await puppeteer.launch();
// Disconnect puppeteer from Chromium // Store the endpoint to be able to reconnect to Chromium
browser.disconnect(); const browserWSEndpoint = browser.wsEndpoint();
// Disconnect puppeteer from Chromium
// Use the endpoint to reestablish a connection browser.disconnect();
const browser2 = await puppeteer.connect({browserWSEndpoint});
// Close Chromium // Use the endpoint to reestablish a connection
await browser2.close(); const browser2 = await puppeteer.connect({browserWSEndpoint});
})(); // Close Chromium
``` await browser2.close();
})();
## Methods ```
| Method | Modifiers | Description | ## Methods
| --- | --- | --- |
| [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). | | Method | Modifiers | Description |
| [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. | | [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). |
| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. | | [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. |
| [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. | | [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. |
| [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. | | [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. |
| [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. | | [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. |
| [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside the Browser. | | [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. |
| [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). | | [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. |
| [target()](./puppeteer.browser.target.md) | | The target associated with the browser. | | [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside 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. | | [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). |
| [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). | | [target()](./puppeteer.browser.target.md) | | The target associated with the browser. |
| [version()](./puppeteer.browser.version.md) | | A string representing the browser name and version. | | [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. |
| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | Searches for a target 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). |
| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.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). |

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.newPage sidebar_label: Browser.newPage
--- ---
# Browser.newPage() method
# Browser.newPage() method
Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context.
Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context.
**Signature:**
**Signature:**
```typescript
class Browser {newPage(): Promise<Page>;} ```typescript
``` class Browser {
**Returns:** newPage(): Promise<Page>;
}
Promise&lt;[Page](./puppeteer.page.md)&gt; ```
**Returns:**
Promise&lt;[Page](./puppeteer.page.md)&gt;

View File

@ -1,20 +1,23 @@
--- ---
sidebar_label: Browser.pages sidebar_label: Browser.pages
--- ---
# Browser.pages() method
# Browser.pages() method
An array of all open pages inside the Browser.
An array of all open pages inside the Browser.
**Signature:**
**Signature:**
```typescript
class Browser {pages(): Promise<Page[]>;} ```typescript
``` class Browser {
**Returns:** pages(): Promise<Page[]>;
}
Promise&lt;[Page](./puppeteer.page.md)\[\]&gt; ```
## Remarks **Returns:**
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). Promise&lt;[Page](./puppeteer.page.md)\[\]&gt;
## 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).

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.process sidebar_label: Browser.process
--- ---
# Browser.process() method
# Browser.process() method
The spawned browser process. Returns `null` if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
The spawned browser process. Returns `null` if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
**Signature:**
**Signature:**
```typescript
class Browser {process(): ChildProcess | null;} ```typescript
``` class Browser {
**Returns:** process(): ChildProcess | null;
}
ChildProcess \| null ```
**Returns:**
ChildProcess \| null

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.target sidebar_label: Browser.target
--- ---
# Browser.target() method
# Browser.target() method
The target associated with the browser.
The target associated with the browser.
**Signature:**
**Signature:**
```typescript
class Browser {target(): Target;} ```typescript
``` class Browser {
**Returns:** target(): Target;
}
[Target](./puppeteer.target.md) ```
**Returns:**
[Target](./puppeteer.target.md)

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.targets sidebar_label: Browser.targets
--- ---
# Browser.targets() method
# 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.
All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts.
**Signature:**
**Signature:**
```typescript
class Browser {targets(): Target[];} ```typescript
``` class Browser {
**Returns:** targets(): Target[];
}
[Target](./puppeteer.target.md)\[\] ```
**Returns:**
[Target](./puppeteer.target.md)\[\]

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: Browser.userAgent sidebar_label: Browser.userAgent
--- ---
# Browser.userAgent() method
# Browser.userAgent() method
The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).
The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).
**Signature:**
**Signature:**
```typescript
class Browser {userAgent(): Promise<string>;} ```typescript
``` class Browser {
**Returns:** userAgent(): Promise<string>;
}
Promise&lt;string&gt; ```
**Returns:**
Promise&lt;string&gt;

View File

@ -1,22 +1,25 @@
--- ---
sidebar_label: Browser.version sidebar_label: Browser.version
--- ---
# Browser.version() method
# Browser.version() method
A string representing the browser name and version.
A string representing the browser name and version.
**Signature:**
**Signature:**
```typescript
class Browser {version(): Promise<string>;} ```typescript
``` class Browser {
**Returns:** version(): Promise<string>;
}
Promise&lt;string&gt; ```
## Remarks **Returns:**
For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For non-headless, this is similar to `Chrome/61.0.3153.0`. Promise&lt;string&gt;
The format of browser.version() might change with future releases of Chromium. ## 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.

View File

@ -1,35 +1,42 @@
--- ---
sidebar_label: Browser.waitForTarget sidebar_label: Browser.waitForTarget
--- ---
# Browser.waitForTarget() method
# Browser.waitForTarget() method
Searches for a target in all browser contexts.
Searches for a target in all browser contexts.
**Signature:**
**Signature:**
```typescript
class Browser {waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;} ```typescript
``` class Browser {
waitForTarget(
## Parameters predicate: (x: Target) => boolean | Promise<boolean>,
options?: WaitForTargetOptions
| Parameter | Type | Description | ): Promise<Target>;
| --- | --- | --- | }
| predicate | (x: [Target](./puppeteer.target.md)) =&gt; boolean \| Promise&lt;boolean&gt; | A function to be run for every target. | ```
| options | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | <i>(Optional)</i> |
## Parameters
**Returns:**
| Parameter | Type | Description |
Promise&lt;[Target](./puppeteer.target.md)&gt; | --------- | ---------------------------------------------------------------------------- | -------------------------------------- |
| predicate | (x: [Target](./puppeteer.target.md)) =&gt; boolean \| Promise&lt;boolean&gt; | A function to be run for every target. |
The first target found that matches the `predicate` function. | options | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | <i>(Optional)</i> |
## Example **Returns:**
An example of finding a target for a page opened via `window.open`: Promise&lt;[Target](./puppeteer.target.md)&gt;
```ts The first target found that matches the `predicate` function.
await page.evaluate(() => window.open('https://www.example.com/'));
const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/'); ## 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/'
);
```

View File

@ -1,24 +1,27 @@
--- ---
sidebar_label: Browser.wsEndpoint sidebar_label: Browser.wsEndpoint
--- ---
# Browser.wsEndpoint() method
# Browser.wsEndpoint() method
The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
**Signature:**
**Signature:**
```typescript
class Browser {wsEndpoint(): string;} ```typescript
``` class Browser {
**Returns:** wsEndpoint(): string;
}
string ```
The Browser websocket url. **Returns:**
## Remarks string
The format is `ws://${host}:${port}/devtools/browser/<id>`. The Browser websocket url.
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). ## 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).

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserConnectOptions.defaultViewport sidebar_label: BrowserConnectOptions.defaultViewport
--- ---
# BrowserConnectOptions.defaultViewport property
# BrowserConnectOptions.defaultViewport property
Sets the viewport for each page.
Sets the viewport for each page.
**Signature:**
**Signature:**
```typescript
interface BrowserConnectOptions {defaultViewport?: Viewport | null;} ```typescript
``` interface BrowserConnectOptions {
defaultViewport?: Viewport | null;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserConnectOptions.ignoreHTTPSErrors sidebar_label: BrowserConnectOptions.ignoreHTTPSErrors
--- ---
# BrowserConnectOptions.ignoreHTTPSErrors property
# BrowserConnectOptions.ignoreHTTPSErrors property
Whether to ignore HTTPS errors during navigation.
Whether to ignore HTTPS errors during navigation.
**Signature:**
**Signature:**
```typescript
interface BrowserConnectOptions {ignoreHTTPSErrors?: boolean;} ```typescript
``` interface BrowserConnectOptions {
ignoreHTTPSErrors?: boolean;
}
```

View File

@ -1,22 +1,22 @@
--- ---
sidebar_label: BrowserConnectOptions sidebar_label: BrowserConnectOptions
--- ---
# BrowserConnectOptions interface
# BrowserConnectOptions interface
Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance.
Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance.
**Signature:**
**Signature:**
```typescript
export interface BrowserConnectOptions ```typescript
``` export interface BrowserConnectOptions
```
## Properties
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | 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. | | [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | | [Viewport](./puppeteer.viewport.md) \| null | <i>(Optional)</i> Sets the viewport for each page. |
| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | | number | <i>(Optional)</i> Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | | [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | | boolean | <i>(Optional)</i> Whether to ignore HTTPS errors during navigation. |
| [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. | | [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. |

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserConnectOptions.slowMo sidebar_label: BrowserConnectOptions.slowMo
--- ---
# BrowserConnectOptions.slowMo property
# BrowserConnectOptions.slowMo property
Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging.
Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging.
**Signature:**
**Signature:**
```typescript
interface BrowserConnectOptions {slowMo?: number;} ```typescript
``` interface BrowserConnectOptions {
slowMo?: number;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserConnectOptions.targetFilter sidebar_label: BrowserConnectOptions.targetFilter
--- ---
# BrowserConnectOptions.targetFilter property
# BrowserConnectOptions.targetFilter property
Callback to decide if Puppeteer should connect to a given target or not.
Callback to decide if Puppeteer should connect to a given target or not.
**Signature:**
**Signature:**
```typescript
interface BrowserConnectOptions {targetFilter?: TargetFilterCallback;} ```typescript
``` interface BrowserConnectOptions {
targetFilter?: TargetFilterCallback;
}
```

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserContext.browser sidebar_label: BrowserContext.browser
--- ---
# BrowserContext.browser() method
# BrowserContext.browser() method
The browser this browser context belongs to.
The browser this browser context belongs to.
**Signature:**
**Signature:**
```typescript
class BrowserContext {browser(): Browser;} ```typescript
``` class BrowserContext {
**Returns:** browser(): Browser;
}
[Browser](./puppeteer.browser.md) ```
**Returns:**
[Browser](./puppeteer.browser.md)

View File

@ -1,26 +1,28 @@
--- ---
sidebar_label: BrowserContext.clearPermissionOverrides sidebar_label: BrowserContext.clearPermissionOverrides
--- ---
# BrowserContext.clearPermissionOverrides() method
# BrowserContext.clearPermissionOverrides() method
Clears all permission overrides for the browser context.
Clears all permission overrides for the browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {clearPermissionOverrides(): Promise<void>;} ```typescript
``` class BrowserContext {
**Returns:** clearPermissionOverrides(): Promise<void>;
}
Promise&lt;void&gt; ```
## Example **Returns:**
Promise&lt;void&gt;
```ts
const context = browser.defaultBrowserContext(); ## Example
context.overridePermissions('https://example.com', ['clipboard-read']);
// do stuff .. ```ts
context.clearPermissionOverrides(); const context = browser.defaultBrowserContext();
``` context.overridePermissions('https://example.com', ['clipboard-read']);
// do stuff ..
context.clearPermissionOverrides();
```

View File

@ -1,20 +1,23 @@
--- ---
sidebar_label: BrowserContext.close sidebar_label: BrowserContext.close
--- ---
# BrowserContext.close() method
# BrowserContext.close() method
Closes the browser context. All the targets that belong to the browser context will be closed.
Closes the browser context. All the targets that belong to the browser context will be closed.
**Signature:**
**Signature:**
```typescript
class BrowserContext {close(): Promise<void>;} ```typescript
``` class BrowserContext {
**Returns:** close(): Promise<void>;
}
Promise&lt;void&gt; ```
## Remarks **Returns:**
Only incognito browser contexts can be closed. Promise&lt;void&gt;
## Remarks
Only incognito browser contexts can be closed.

View File

@ -1,20 +1,23 @@
--- ---
sidebar_label: BrowserContext.isIncognito sidebar_label: BrowserContext.isIncognito
--- ---
# BrowserContext.isIncognito() method
# BrowserContext.isIncognito() method
Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.
Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {isIncognito(): boolean;} ```typescript
``` class BrowserContext {
**Returns:** isIncognito(): boolean;
}
boolean ```
## Remarks **Returns:**
The default browser context cannot be closed. boolean
## Remarks
The default browser context cannot be closed.

View File

@ -1,52 +1,52 @@
--- ---
sidebar_label: BrowserContext sidebar_label: BrowserContext
--- ---
# BrowserContext class
# 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.
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:**
**Signature:**
```typescript
export declare class BrowserContext extends EventEmitter ```typescript
``` export declare class BrowserContext extends EventEmitter
**Extends:** [EventEmitter](./puppeteer.eventemitter.md) ```
## Remarks **Extends:** [EventEmitter](./puppeteer.eventemitter.md)
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. ## Remarks
If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context. 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.
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. If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context.
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. 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.
## Example 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 ```ts
const context = await browser.createIncognitoBrowserContext(); // Create a new incognito browser context
// Create a new page inside context. const context = await browser.createIncognitoBrowserContext();
const page = await context.newPage(); // Create a new page inside context.
// ... do stuff with page ... const page = await context.newPage();
await page.goto('https://example.com'); // ... do stuff with page ...
// Dispose context once it's no longer needed. await page.goto('https://example.com');
await context.close(); // Dispose context once it's no longer needed.
``` await context.close();
```
## Methods
## Methods
| Method | Modifiers | Description |
| --- | --- | --- | | 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. | | [browser()](./puppeteer.browsercontext.browser.md) | | The browser this browser context belongs to. |
| [close()](./puppeteer.browsercontext.close.md) | | Closes the browser context. All the targets that belong to the browser context will be closed. | | [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for the browser context. |
| [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context. | | [close()](./puppeteer.browsercontext.close.md) | | Closes the browser context. All the targets that belong to the browser context will be closed. |
| [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new page in the browser context. | | [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context. |
| [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | | | [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new page in the browser context. |
| [pages()](./puppeteer.browsercontext.pages.md) | | An array of all pages inside the browser context. | | [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | |
| [targets()](./puppeteer.browsercontext.targets.md) | | An array of all active targets inside the browser context. | | [pages()](./puppeteer.browsercontext.pages.md) | | An array of all pages inside the browser context. |
| [waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md) | | This searches for a target in this specific 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. |

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserContext.newPage sidebar_label: BrowserContext.newPage
--- ---
# BrowserContext.newPage() method
# BrowserContext.newPage() method
Creates a new page in the browser context.
Creates a new page in the browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {newPage(): Promise<Page>;} ```typescript
``` class BrowserContext {
**Returns:** newPage(): Promise<Page>;
}
Promise&lt;[Page](./puppeteer.page.md)&gt; ```
**Returns:**
Promise&lt;[Page](./puppeteer.page.md)&gt;

View File

@ -1,30 +1,31 @@
--- ---
sidebar_label: BrowserContext.overridePermissions sidebar_label: BrowserContext.overridePermissions
--- ---
# BrowserContext.overridePermissions() method
# BrowserContext.overridePermissions() method
**Signature:**
**Signature:**
```typescript
class BrowserContext {overridePermissions(origin: string, permissions: Permission[]): Promise<void>;} ```typescript
``` class BrowserContext {
overridePermissions(origin: string, permissions: Permission[]): Promise<void>;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| 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. | | Parameter | Type | Description |
| ----------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
**Returns:** | 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. |
Promise&lt;void&gt;
**Returns:**
## Example
Promise&lt;void&gt;
```ts ## Example
const context = browser.defaultBrowserContext();
await context.overridePermissions('https://html5demos.com', ['geolocation']); ```ts
``` const context = browser.defaultBrowserContext();
await context.overridePermissions('https://html5demos.com', ['geolocation']);
```

View File

@ -1,18 +1,21 @@
--- ---
sidebar_label: BrowserContext.pages sidebar_label: BrowserContext.pages
--- ---
# BrowserContext.pages() method
# BrowserContext.pages() method
An array of all pages inside the browser context.
An array of all pages inside the browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {pages(): Promise<Page[]>;} ```typescript
``` class BrowserContext {
**Returns:** pages(): Promise<Page[]>;
}
Promise&lt;[Page](./puppeteer.page.md)\[\]&gt; ```
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). **Returns:**
Promise&lt;[Page](./puppeteer.page.md)\[\]&gt;
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).

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserContext.targets sidebar_label: BrowserContext.targets
--- ---
# BrowserContext.targets() method
# BrowserContext.targets() method
An array of all active targets inside the browser context.
An array of all active targets inside the browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {targets(): Target[];} ```typescript
``` class BrowserContext {
**Returns:** targets(): Target[];
}
[Target](./puppeteer.target.md)\[\] ```
**Returns:**
[Target](./puppeteer.target.md)\[\]

View File

@ -1,37 +1,44 @@
--- ---
sidebar_label: BrowserContext.waitForTarget sidebar_label: BrowserContext.waitForTarget
--- ---
# BrowserContext.waitForTarget() method
# BrowserContext.waitForTarget() method
This searches for a target in this specific browser context.
This searches for a target in this specific browser context.
**Signature:**
**Signature:**
```typescript
class BrowserContext {waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: { ```typescript
timeout?: number; class BrowserContext {
}): Promise<Target>;} waitForTarget(
``` predicate: (x: Target) => boolean | Promise<boolean>,
options?: {
## Parameters timeout?: number;
}
| Parameter | Type | Description | ): Promise<Target>;
| --- | --- | --- | }
| predicate | (x: [Target](./puppeteer.target.md)) =&gt; boolean \| Promise&lt;boolean&gt; | 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. |
## Parameters
**Returns:**
| Parameter | Type | Description |
Promise&lt;[Target](./puppeteer.target.md)&gt; | --------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| predicate | (x: [Target](./puppeteer.target.md)) =&gt; boolean \| Promise&lt;boolean&gt; | A function to be run for every target |
Promise which resolves to the first target found that matches the `predicate` function. | 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. |
## Example **Returns:**
An example of finding a target for a page opened via `window.open`: Promise&lt;[Target](./puppeteer.target.md)&gt;
```ts Promise which resolves to the first target found that matches the `predicate` function.
await page.evaluate(() => window.open('https://www.example.com/'));
const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/'); ## 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/'
);
```

View File

@ -1,20 +1,19 @@
--- ---
sidebar_label: BrowserContextEmittedEvents sidebar_label: BrowserContextEmittedEvents
--- ---
# BrowserContextEmittedEvents enum
# BrowserContextEmittedEvents enum
**Signature:** **Signature:**
```typescript ```typescript
export declare const enum BrowserContextEmittedEvents export declare const enum BrowserContextEmittedEvents
``` ```
## Enumeration Members ## Enumeration Members
| Member | Value | Description | | Member | Value | Description |
| --- | --- | --- | | --------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TargetChanged | <code>&quot;targetchanged&quot;</code> | Emitted when the url of a target inside the browser context changes. Contains a [Target](./puppeteer.target.md) instance. | | TargetChanged | <code>&quot;targetchanged&quot;</code> | Emitted when the url of a target inside the browser context changes. Contains a [Target](./puppeteer.target.md) instance. |
| TargetCreated | <code>&quot;targetcreated&quot;</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> | | TargetCreated | <code>&quot;targetcreated&quot;</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>&quot;targetdestroyed&quot;</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. | | TargetDestroyed | <code>&quot;targetdestroyed&quot;</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. |

View File

@ -1,20 +1,20 @@
--- ---
sidebar_label: BrowserContextOptions sidebar_label: BrowserContextOptions
--- ---
# BrowserContextOptions interface
# BrowserContextOptions interface
BrowserContext options.
BrowserContext options.
**Signature:**
**Signature:**
```typescript
export interface BrowserContextOptions ```typescript
``` export interface BrowserContextOptions
```
## Properties
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | 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>. | | [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>. |

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserContextOptions.proxyBypassList sidebar_label: BrowserContextOptions.proxyBypassList
--- ---
# BrowserContextOptions.proxyBypassList property
# BrowserContextOptions.proxyBypassList property
Bypass the proxy for the given semi-colon-separated list of hosts.
Bypass the proxy for the given semi-colon-separated list of hosts.
**Signature:**
**Signature:**
```typescript
interface BrowserContextOptions {proxyBypassList?: string[];} ```typescript
``` interface BrowserContextOptions {
proxyBypassList?: string[];
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserContextOptions.proxyServer sidebar_label: BrowserContextOptions.proxyServer
--- ---
# BrowserContextOptions.proxyServer property
# BrowserContextOptions.proxyServer property
Proxy server with optional port to use for all requests. Username and password can be set in `Page.authenticate`.
Proxy server with optional port to use for all requests. Username and password can be set in `Page.authenticate`.
**Signature:**
**Signature:**
```typescript
interface BrowserContextOptions {proxyServer?: string;} ```typescript
``` interface BrowserContextOptions {
proxyServer?: string;
}
```

View File

@ -1,22 +1,22 @@
--- ---
sidebar_label: BrowserEmittedEvents sidebar_label: BrowserEmittedEvents
--- ---
# BrowserEmittedEvents enum
# BrowserEmittedEvents enum
All the events a [browser instance](./puppeteer.browser.md) may emit.
All the events a [browser instance](./puppeteer.browser.md) may emit.
**Signature:**
**Signature:**
```typescript
export declare const enum BrowserEmittedEvents ```typescript
``` export declare const enum BrowserEmittedEvents
```
## Enumeration Members
## Enumeration Members
| Member | Value | Description |
| --- | --- | --- | | Member | Value | Description |
| Disconnected | <code>&quot;disconnected&quot;</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>&quot;targetchanged&quot;</code> | Emitted when the url of a target changes. Contains a [Target](./puppeteer.target.md) instance. | | Disconnected | <code>&quot;disconnected&quot;</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> |
| TargetCreated | <code>&quot;targetcreated&quot;</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> | | TargetChanged | <code>&quot;targetchanged&quot;</code> | Emitted when the url of a target changes. Contains a [Target](./puppeteer.target.md) instance. |
| TargetDestroyed | <code>&quot;targetdestroyed&quot;</code> | Emitted when a target is destroyed, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. | | TargetCreated | <code>&quot;targetcreated&quot;</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>&quot;targetdestroyed&quot;</code> | Emitted when a target is destroyed, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. |

View File

@ -1,29 +1,31 @@
--- ---
sidebar_label: BrowserFetcher.canDownload sidebar_label: BrowserFetcher.canDownload
--- ---
# BrowserFetcher.canDownload() method
# BrowserFetcher.canDownload() method
Initiates a HEAD request to check if the revision is available.
Initiates a HEAD request to check if the revision is available.
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {canDownload(revision: string): Promise<boolean>;} ```typescript
``` class BrowserFetcher {
canDownload(revision: string): Promise<boolean>;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| revision | string | The revision to check availability for. |
| Parameter | Type | Description |
**Returns:** | --------- | ------ | --------------------------------------- |
| revision | string | The revision to check availability for. |
Promise&lt;boolean&gt;
**Returns:**
A promise that resolves to `true` if the revision could be downloaded from the host.
Promise&lt;boolean&gt;
## Remarks
A promise that resolves to `true` if the revision could be downloaded from the host.
This method is affected by the current `product`.
## Remarks
This method is affected by the current `product`.

View File

@ -1,30 +1,35 @@
--- ---
sidebar_label: BrowserFetcher.download sidebar_label: BrowserFetcher.download
--- ---
# BrowserFetcher.download() method
# BrowserFetcher.download() method
Initiates a GET request to download the revision from the host.
Initiates a GET request to download the revision from the host.
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {download(revision: string, progressCallback?: (x: number, y: number) => void): Promise<BrowserFetcherRevisionInfo | undefined>;} ```typescript
``` class BrowserFetcher {
download(
## Parameters revision: string,
progressCallback?: (x: number, y: number) => void
| Parameter | Type | Description | ): Promise<BrowserFetcherRevisionInfo | undefined>;
| --- | --- | --- | }
| revision | string | The revision to download. | ```
| progressCallback | (x: number, y: number) =&gt; 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. |
## Parameters
**Returns:**
| Parameter | Type | Description |
Promise&lt;[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) \| undefined&gt; | ---------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| revision | string | The revision to download. |
A promise with revision information when the revision is downloaded and extracted. | progressCallback | (x: number, y: number) =&gt; 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. |
## Remarks **Returns:**
This method is affected by the current `product`. Promise&lt;[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) \| undefined&gt;
A promise with revision information when the revision is downloaded and extracted.
## Remarks
This method is affected by the current `product`.

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserFetcher.host sidebar_label: BrowserFetcher.host
--- ---
# BrowserFetcher.host() method
# BrowserFetcher.host() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {host(): string;} ```typescript
``` class BrowserFetcher {
**Returns:** host(): string;
}
string ```
The download host being used. **Returns:**
string
The download host being used.

View File

@ -1,20 +1,23 @@
--- ---
sidebar_label: BrowserFetcher.localRevisions sidebar_label: BrowserFetcher.localRevisions
--- ---
# BrowserFetcher.localRevisions() method
# BrowserFetcher.localRevisions() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {localRevisions(): Promise<string[]>;} ```typescript
``` class BrowserFetcher {
**Returns:** localRevisions(): Promise<string[]>;
}
Promise&lt;string\[\]&gt; ```
A promise with a list of all revision strings (for the current `product`) available locally on disk. **Returns:**
## Remarks Promise&lt;string\[\]&gt;
This method is affected by the current `product`. 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`.

View File

@ -1,43 +1,46 @@
--- ---
sidebar_label: BrowserFetcher sidebar_label: BrowserFetcher
--- ---
# BrowserFetcher class
# BrowserFetcher class
BrowserFetcher can download and manage different versions of Chromium and Firefox.
BrowserFetcher can download and manage different versions of Chromium and Firefox.
**Signature:**
**Signature:**
```typescript
export declare class BrowserFetcher ```typescript
``` export declare class BrowserFetcher
```
## Remarks
## 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"`.
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.
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
## Example
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
```ts
const browserFetcher = puppeteer.createBrowserFetcher(); ```ts
const revisionInfo = await browserFetcher.download('533271'); const browserFetcher = puppeteer.createBrowserFetcher();
const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath}) const revisionInfo = await browserFetcher.download('533271');
``` const browser = await puppeteer.launch({
\*\*NOTE\*\* BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory. executablePath: revisionInfo.executablePath,
});
## Methods ```
| Method | Modifiers | Description | \*\*NOTE\*\* BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
| --- | --- | --- |
| [canDownload(revision)](./puppeteer.browserfetcher.candownload.md) | | Initiates a HEAD request to check if the revision is available. | ## Methods
| [download(revision, progressCallback)](./puppeteer.browserfetcher.download.md) | | Initiates a GET request to download the revision from the host. |
| [host()](./puppeteer.browserfetcher.host.md) | | | | Method | Modifiers | Description |
| [localRevisions()](./puppeteer.browserfetcher.localrevisions.md) | | | | ------------------------------------------------------------------------------ | --------- | --------------------------------------------------------------- |
| [platform()](./puppeteer.browserfetcher.platform.md) | | | | [canDownload(revision)](./puppeteer.browserfetcher.candownload.md) | | Initiates a HEAD request to check if the revision is available. |
| [product()](./puppeteer.browserfetcher.product.md) | | | | [download(revision, progressCallback)](./puppeteer.browserfetcher.download.md) | | Initiates a GET request to download the revision from the host. |
| [remove(revision)](./puppeteer.browserfetcher.remove.md) | | | | [host()](./puppeteer.browserfetcher.host.md) | | |
| [revisionInfo(revision)](./puppeteer.browserfetcher.revisioninfo.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) | | |

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserFetcher.platform sidebar_label: BrowserFetcher.platform
--- ---
# BrowserFetcher.platform() method
# BrowserFetcher.platform() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {platform(): Platform;} ```typescript
``` class BrowserFetcher {
**Returns:** platform(): Platform;
}
[Platform](./puppeteer.platform.md) ```
Returns the current `Platform`, which is one of `mac`, `linux`, `win32` or `win64`. **Returns:**
[Platform](./puppeteer.platform.md)
Returns the current `Platform`, which is one of `mac`, `linux`, `win32` or `win64`.

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: BrowserFetcher.product sidebar_label: BrowserFetcher.product
--- ---
# BrowserFetcher.product() method
# BrowserFetcher.product() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {product(): Product;} ```typescript
``` class BrowserFetcher {
**Returns:** product(): Product;
}
[Product](./puppeteer.product.md) ```
Returns the current `Product`, which is one of `chrome` or `firefox`. **Returns:**
[Product](./puppeteer.product.md)
Returns the current `Product`, which is one of `chrome` or `firefox`.

View File

@ -1,27 +1,29 @@
--- ---
sidebar_label: BrowserFetcher.remove sidebar_label: BrowserFetcher.remove
--- ---
# BrowserFetcher.remove() method
# BrowserFetcher.remove() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {remove(revision: string): Promise<void>;} ```typescript
``` class BrowserFetcher {
remove(revision: string): Promise<void>;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| revision | string | A revision to remove for the current <code>product</code>. |
| Parameter | Type | Description |
**Returns:** | --------- | ------ | ---------------------------------------------------------- |
| revision | string | A revision to remove for the current <code>product</code>. |
Promise&lt;void&gt;
**Returns:**
A promise that resolves when the revision has been removes or throws if the revision has not been downloaded.
Promise&lt;void&gt;
## Remarks
A promise that resolves when the revision has been removes or throws if the revision has not been downloaded.
This method is affected by the current `product`.
## Remarks
This method is affected by the current `product`.

View File

@ -1,23 +1,25 @@
--- ---
sidebar_label: BrowserFetcher.revisionInfo sidebar_label: BrowserFetcher.revisionInfo
--- ---
# BrowserFetcher.revisionInfo() method
# BrowserFetcher.revisionInfo() method
**Signature:**
**Signature:**
```typescript
class BrowserFetcher {revisionInfo(revision: string): BrowserFetcherRevisionInfo;} ```typescript
``` class BrowserFetcher {
revisionInfo(revision: string): BrowserFetcherRevisionInfo;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| revision | string | The revision to get info for. |
| Parameter | Type | Description |
**Returns:** | --------- | ------ | ----------------------------- |
| revision | string | The revision to get info for. |
[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)
**Returns:**
The revision info for the given revision.
[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)
The revision info for the given revision.

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherOptions.host sidebar_label: BrowserFetcherOptions.host
--- ---
# BrowserFetcherOptions.host property
# BrowserFetcherOptions.host property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherOptions {host?: string;} ```typescript
``` interface BrowserFetcherOptions {
host?: string;
}
```

View File

@ -1,21 +1,20 @@
--- ---
sidebar_label: BrowserFetcherOptions sidebar_label: BrowserFetcherOptions
--- ---
# BrowserFetcherOptions interface
# BrowserFetcherOptions interface
**Signature:** **Signature:**
```typescript ```typescript
export interface BrowserFetcherOptions export interface BrowserFetcherOptions
``` ```
## Properties ## Properties
| Property | Modifiers | Type | Description | | Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | ---------------------------------------------------------- | --------- | ----------------------------------- | ----------------- |
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> | | [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> |
| [path?](./puppeteer.browserfetcheroptions.path.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> | | [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> |
| [product?](./puppeteer.browserfetcheroptions.product.md) | | string | <i>(Optional)</i> | | [product?](./puppeteer.browserfetcheroptions.product.md) | | string | <i>(Optional)</i> |

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherOptions.path sidebar_label: BrowserFetcherOptions.path
--- ---
# BrowserFetcherOptions.path property
# BrowserFetcherOptions.path property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherOptions {path?: string;} ```typescript
``` interface BrowserFetcherOptions {
path?: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherOptions.platform sidebar_label: BrowserFetcherOptions.platform
--- ---
# BrowserFetcherOptions.platform property
# BrowserFetcherOptions.platform property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherOptions {platform?: Platform;} ```typescript
``` interface BrowserFetcherOptions {
platform?: Platform;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherOptions.product sidebar_label: BrowserFetcherOptions.product
--- ---
# BrowserFetcherOptions.product property
# BrowserFetcherOptions.product property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherOptions {product?: string;} ```typescript
``` interface BrowserFetcherOptions {
product?: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.executablePath sidebar_label: BrowserFetcherRevisionInfo.executablePath
--- ---
# BrowserFetcherRevisionInfo.executablePath property
# BrowserFetcherRevisionInfo.executablePath property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {executablePath: string;} ```typescript
``` interface BrowserFetcherRevisionInfo {
executablePath: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.folderPath sidebar_label: BrowserFetcherRevisionInfo.folderPath
--- ---
# BrowserFetcherRevisionInfo.folderPath property
# BrowserFetcherRevisionInfo.folderPath property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {folderPath: string;} ```typescript
``` interface BrowserFetcherRevisionInfo {
folderPath: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.local sidebar_label: BrowserFetcherRevisionInfo.local
--- ---
# BrowserFetcherRevisionInfo.local property
# BrowserFetcherRevisionInfo.local property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {local: boolean;} ```typescript
``` interface BrowserFetcherRevisionInfo {
local: boolean;
}
```

View File

@ -1,23 +1,22 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo sidebar_label: BrowserFetcherRevisionInfo
--- ---
# BrowserFetcherRevisionInfo interface
# BrowserFetcherRevisionInfo interface
**Signature:** **Signature:**
```typescript ```typescript
export interface BrowserFetcherRevisionInfo export interface BrowserFetcherRevisionInfo
``` ```
## Properties ## Properties
| Property | Modifiers | Type | Description | | Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | -------------------------------------------------------------------------- | --------- | ------- | ----------- |
| [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md) | | string | | | [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md) | | string | |
| [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md) | | string | | | [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md) | | string | |
| [local](./puppeteer.browserfetcherrevisioninfo.local.md) | | boolean | | | [local](./puppeteer.browserfetcherrevisioninfo.local.md) | | boolean | |
| [product](./puppeteer.browserfetcherrevisioninfo.product.md) | | string | | | [product](./puppeteer.browserfetcherrevisioninfo.product.md) | | string | |
| [revision](./puppeteer.browserfetcherrevisioninfo.revision.md) | | string | | | [revision](./puppeteer.browserfetcherrevisioninfo.revision.md) | | string | |
| [url](./puppeteer.browserfetcherrevisioninfo.url.md) | | string | | | [url](./puppeteer.browserfetcherrevisioninfo.url.md) | | string | |

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.product sidebar_label: BrowserFetcherRevisionInfo.product
--- ---
# BrowserFetcherRevisionInfo.product property
# BrowserFetcherRevisionInfo.product property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {product: string;} ```typescript
``` interface BrowserFetcherRevisionInfo {
product: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.revision sidebar_label: BrowserFetcherRevisionInfo.revision
--- ---
# BrowserFetcherRevisionInfo.revision property
# BrowserFetcherRevisionInfo.revision property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {revision: string;} ```typescript
``` interface BrowserFetcherRevisionInfo {
revision: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserFetcherRevisionInfo.url sidebar_label: BrowserFetcherRevisionInfo.url
--- ---
# BrowserFetcherRevisionInfo.url property
# BrowserFetcherRevisionInfo.url property
**Signature:**
**Signature:**
```typescript
interface BrowserFetcherRevisionInfo {url: string;} ```typescript
``` interface BrowserFetcherRevisionInfo {
url: string;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions.args sidebar_label: BrowserLaunchArgumentOptions.args
--- ---
# BrowserLaunchArgumentOptions.args property
# BrowserLaunchArgumentOptions.args property
Additional command line arguments to pass to the browser instance.
Additional command line arguments to pass to the browser instance.
**Signature:**
**Signature:**
```typescript
interface BrowserLaunchArgumentOptions {args?: string[];} ```typescript
``` interface BrowserLaunchArgumentOptions {
args?: string[];
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions.debuggingPort sidebar_label: BrowserLaunchArgumentOptions.debuggingPort
--- ---
# BrowserLaunchArgumentOptions.debuggingPort property
# BrowserLaunchArgumentOptions.debuggingPort property
**Signature:**
**Signature:**
```typescript
interface BrowserLaunchArgumentOptions {debuggingPort?: number;} ```typescript
``` interface BrowserLaunchArgumentOptions {
debuggingPort?: number;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions.devtools sidebar_label: BrowserLaunchArgumentOptions.devtools
--- ---
# BrowserLaunchArgumentOptions.devtools property
# 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`.
Whether to auto-open a DevTools panel for each tab. If this is set to `true`, then `headless` will be forced to `false`.
**Signature:**
**Signature:**
```typescript
interface BrowserLaunchArgumentOptions {devtools?: boolean;} ```typescript
``` interface BrowserLaunchArgumentOptions {
devtools?: boolean;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions.headless sidebar_label: BrowserLaunchArgumentOptions.headless
--- ---
# BrowserLaunchArgumentOptions.headless property
# BrowserLaunchArgumentOptions.headless property
Whether to run the browser in headless mode.
Whether to run the browser in headless mode.
**Signature:**
**Signature:**
```typescript
interface BrowserLaunchArgumentOptions {headless?: boolean | 'chrome';} ```typescript
``` interface BrowserLaunchArgumentOptions {
headless?: boolean | 'chrome';
}
```

View File

@ -1,23 +1,23 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions sidebar_label: BrowserLaunchArgumentOptions
--- ---
# BrowserLaunchArgumentOptions interface
# BrowserLaunchArgumentOptions interface
Launcher options that only apply to Chrome.
Launcher options that only apply to Chrome.
**Signature:**
**Signature:**
```typescript
export interface BrowserLaunchArgumentOptions ```typescript
``` export interface BrowserLaunchArgumentOptions
```
## Properties
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | 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> | | [args?](./puppeteer.browserlaunchargumentoptions.args.md) | | string\[\] | <i>(Optional)</i> Additional command line arguments to pass to the browser instance. |
| [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>. | | [debuggingPort?](./puppeteer.browserlaunchargumentoptions.debuggingport.md) | | number | <i>(Optional)</i> |
| [headless?](./puppeteer.browserlaunchargumentoptions.headless.md) | | boolean \| 'chrome' | <i>(Optional)</i> Whether to run the browser in headless mode. | | [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>. |
| [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. | | [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. |

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: BrowserLaunchArgumentOptions.userDataDir sidebar_label: BrowserLaunchArgumentOptions.userDataDir
--- ---
# BrowserLaunchArgumentOptions.userDataDir property
# 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.
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:**
**Signature:**
```typescript
interface BrowserLaunchArgumentOptions {userDataDir?: string;} ```typescript
``` interface BrowserLaunchArgumentOptions {
userDataDir?: string;
}
```

View File

@ -1,14 +1,17 @@
--- ---
sidebar_label: CDPSession.connection sidebar_label: CDPSession.connection
--- ---
# CDPSession.connection() method
# CDPSession.connection() method
**Signature:**
**Signature:**
```typescript
class CDPSession {connection(): Connection | undefined;} ```typescript
``` class CDPSession {
**Returns:** connection(): Connection | undefined;
}
[Connection](./puppeteer.connection.md) \| undefined ```
**Returns:**
[Connection](./puppeteer.connection.md) \| undefined

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: CDPSession.detach sidebar_label: CDPSession.detach
--- ---
# CDPSession.detach() method
# 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.
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:**
**Signature:**
```typescript
class CDPSession {detach(): Promise<void>;} ```typescript
``` class CDPSession {
**Returns:** detach(): Promise<void>;
}
Promise&lt;void&gt; ```
**Returns:**
Promise&lt;void&gt;

View File

@ -1,16 +1,19 @@
--- ---
sidebar_label: CDPSession.id sidebar_label: CDPSession.id
--- ---
# CDPSession.id() method
# CDPSession.id() method
Returns the session's id.
Returns the session's id.
**Signature:**
**Signature:**
```typescript
class CDPSession {id(): string;} ```typescript
``` class CDPSession {
**Returns:** id(): string;
}
string ```
**Returns:**
string

View File

@ -1,45 +1,47 @@
--- ---
sidebar_label: CDPSession sidebar_label: CDPSession
--- ---
# CDPSession class
# CDPSession class
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol.
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol.
**Signature:**
**Signature:**
```typescript
export declare class CDPSession extends EventEmitter ```typescript
``` export declare class CDPSession extends EventEmitter
**Extends:** [EventEmitter](./puppeteer.eventemitter.md) ```
## Remarks **Extends:** [EventEmitter](./puppeteer.eventemitter.md)
Protocol methods can be called with [CDPSession.send()](./puppeteer.cdpsession.send.md) method and protocol events can be subscribed to with `CDPSession.on` method. ## Remarks
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). Protocol methods can be called with [CDPSession.send()](./puppeteer.cdpsession.send.md) method and protocol events can be subscribed to with `CDPSession.on` method.
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. 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).
## Example 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(); ```ts
await client.send('Animation.enable'); const client = await page.target().createCDPSession();
client.on('Animation.animationCreated', () => console.log('Animation created!')); await client.send('Animation.enable');
const response = await client.send('Animation.getPlaybackRate'); client.on('Animation.animationCreated', () =>
console.log('playback rate is ' + response.playbackRate); console.log('Animation created!')
await client.send('Animation.setPlaybackRate', { );
playbackRate: response.playbackRate / 2 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 |
| --- | --- | --- | ## Methods
| [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. | | Method | Modifiers | Description |
| [id()](./puppeteer.cdpsession.id.md) | | Returns the session's id. | | --------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| [send(method, paramArgs)](./puppeteer.cdpsession.send.md) | | | | [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) | | |

View File

@ -1,22 +1,27 @@
--- ---
sidebar_label: CDPSession.send sidebar_label: CDPSession.send
--- ---
# CDPSession.send() method
# CDPSession.send() method
**Signature:**
**Signature:**
```typescript
class CDPSession {send<T extends keyof ProtocolMapping.Commands>(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise<ProtocolMapping.Commands[T]['returnType']>;} ```typescript
``` class CDPSession {
send<T extends keyof ProtocolMapping.Commands>(
## Parameters method: T,
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
| Parameter | Type | Description | ): Promise<ProtocolMapping.Commands[T]['returnType']>;
| --- | --- | --- | }
| method | T | | ```
| paramArgs | ProtocolMapping.Commands\[T\]\['paramsType'\] | |
## Parameters
**Returns:**
| Parameter | Type | Description |
Promise&lt;ProtocolMapping.Commands\[T\]\['returnType'\]&gt; | --------- | --------------------------------------------- | ----------- |
| method | T | |
| paramArgs | ProtocolMapping.Commands\[T\]\['paramsType'\] | |
**Returns:**
Promise&lt;ProtocolMapping.Commands\[T\]\['returnType'\]&gt;

View File

@ -1,14 +1,17 @@
--- ---
sidebar_label: CDPSessionOnMessageObject.error sidebar_label: CDPSessionOnMessageObject.error
--- ---
# CDPSessionOnMessageObject.error property
# CDPSessionOnMessageObject.error property
**Signature:**
**Signature:**
```typescript
interface CDPSessionOnMessageObject {error: { ```typescript
message: string; interface CDPSessionOnMessageObject {
data: any; error: {
code: number; message: string;
};} data: any;
``` code: number;
};
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: CDPSessionOnMessageObject.id sidebar_label: CDPSessionOnMessageObject.id
--- ---
# CDPSessionOnMessageObject.id property
# CDPSessionOnMessageObject.id property
**Signature:**
**Signature:**
```typescript
interface CDPSessionOnMessageObject {id?: number;} ```typescript
``` interface CDPSessionOnMessageObject {
id?: number;
}
```

View File

@ -1,22 +1,21 @@
--- ---
sidebar_label: CDPSessionOnMessageObject sidebar_label: CDPSessionOnMessageObject
--- ---
# CDPSessionOnMessageObject interface
# CDPSessionOnMessageObject interface
**Signature:** **Signature:**
```typescript ```typescript
export interface CDPSessionOnMessageObject export interface CDPSessionOnMessageObject
``` ```
## Properties ## Properties
| Property | Modifiers | Type | Description | | Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | ---------------------------------------------------------- | --------- | --------------------------------------------- | ----------------- |
| [error](./puppeteer.cdpsessiononmessageobject.error.md) | | { message: string; data: any; code: number; } | | | [error](./puppeteer.cdpsessiononmessageobject.error.md) | | { message: string; data: any; code: number; } | |
| [id?](./puppeteer.cdpsessiononmessageobject.id.md) | | number | <i>(Optional)</i> | | [id?](./puppeteer.cdpsessiononmessageobject.id.md) | | number | <i>(Optional)</i> |
| [method](./puppeteer.cdpsessiononmessageobject.method.md) | | string | | | [method](./puppeteer.cdpsessiononmessageobject.method.md) | | string | |
| [params](./puppeteer.cdpsessiononmessageobject.params.md) | | Record&lt;string, unknown&gt; | | | [params](./puppeteer.cdpsessiononmessageobject.params.md) | | Record&lt;string, unknown&gt; | |
| [result?](./puppeteer.cdpsessiononmessageobject.result.md) | | any | <i>(Optional)</i> | | [result?](./puppeteer.cdpsessiononmessageobject.result.md) | | any | <i>(Optional)</i> |

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: CDPSessionOnMessageObject.method sidebar_label: CDPSessionOnMessageObject.method
--- ---
# CDPSessionOnMessageObject.method property
# CDPSessionOnMessageObject.method property
**Signature:**
**Signature:**
```typescript
interface CDPSessionOnMessageObject {method: string;} ```typescript
``` interface CDPSessionOnMessageObject {
method: string;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: CDPSessionOnMessageObject.params sidebar_label: CDPSessionOnMessageObject.params
--- ---
# CDPSessionOnMessageObject.params property
# CDPSessionOnMessageObject.params property
**Signature:**
**Signature:**
```typescript
interface CDPSessionOnMessageObject {params: Record<string, unknown>;} ```typescript
``` interface CDPSessionOnMessageObject {
params: Record<string, unknown>;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: CDPSessionOnMessageObject.result sidebar_label: CDPSessionOnMessageObject.result
--- ---
# CDPSessionOnMessageObject.result property
# CDPSessionOnMessageObject.result property
**Signature:**
**Signature:**
```typescript
interface CDPSessionOnMessageObject {result?: any;} ```typescript
``` interface CDPSessionOnMessageObject {
result?: any;
}
```

View File

@ -1,11 +1,15 @@
--- ---
sidebar_label: ChromeReleaseChannel sidebar_label: ChromeReleaseChannel
--- ---
# ChromeReleaseChannel type
# ChromeReleaseChannel type
**Signature:** **Signature:**
```typescript ```typescript
export declare type ChromeReleaseChannel = 'chrome' | 'chrome-beta' | 'chrome-canary' | 'chrome-dev'; export declare type ChromeReleaseChannel =
``` | 'chrome'
| 'chrome-beta'
| 'chrome-canary'
| 'chrome-dev';
```

View File

@ -1,16 +1,17 @@
--- ---
sidebar_label: clearCustomQueryHandlers sidebar_label: clearCustomQueryHandlers
--- ---
# clearCustomQueryHandlers() function
# clearCustomQueryHandlers() function
Clears all registered handlers.
Clears all registered handlers.
**Signature:**
**Signature:**
```typescript
export declare function clearCustomQueryHandlers(): void; ```typescript
``` export declare function clearCustomQueryHandlers(): void;
**Returns:** ```
void **Returns:**
void

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: ClickOptions.button sidebar_label: ClickOptions.button
--- ---
# ClickOptions.button property
# ClickOptions.button property
**Signature:**
**Signature:**
```typescript
interface ClickOptions {button?: MouseButton;} ```typescript
``` interface ClickOptions {
button?: MouseButton;
}
```

View File

@ -1,10 +1,13 @@
--- ---
sidebar_label: ClickOptions.clickCount sidebar_label: ClickOptions.clickCount
--- ---
# ClickOptions.clickCount property
# ClickOptions.clickCount property
**Signature:**
**Signature:**
```typescript
interface ClickOptions {clickCount?: number;} ```typescript
``` interface ClickOptions {
clickCount?: number;
}
```

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: ClickOptions.delay sidebar_label: ClickOptions.delay
--- ---
# ClickOptions.delay property
# ClickOptions.delay property
Time to wait between `mousedown` and `mouseup` in milliseconds.
Time to wait between `mousedown` and `mouseup` in milliseconds.
**Signature:**
**Signature:**
```typescript
interface ClickOptions {delay?: number;} ```typescript
``` interface ClickOptions {
delay?: number;
}
```

View File

@ -1,21 +1,20 @@
--- ---
sidebar_label: ClickOptions sidebar_label: ClickOptions
--- ---
# ClickOptions interface
# ClickOptions interface
**Signature:** **Signature:**
```typescript ```typescript
export interface ClickOptions export interface ClickOptions
``` ```
## Properties ## Properties
| Property | Modifiers | Type | Description | | Property | Modifiers | Type | Description |
| --- | --- | --- | --- | | ----------------------------------------------------- | --------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [button?](./puppeteer.clickoptions.button.md) | | [MouseButton](./puppeteer.mousebutton.md) | <i>(Optional)</i> | | [button?](./puppeteer.clickoptions.button.md) | | [MouseButton](./puppeteer.mousebutton.md) | <i>(Optional)</i> |
| [clickCount?](./puppeteer.clickoptions.clickcount.md) | | number | <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. | | [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. | | [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. |

View File

@ -1,12 +1,15 @@
--- ---
sidebar_label: ClickOptions.offset sidebar_label: ClickOptions.offset
--- ---
# ClickOptions.offset property
# ClickOptions.offset property
Offset for the clickable point relative to the top-left corder of the border box.
Offset for the clickable point relative to the top-left corder of the border box.
**Signature:**
**Signature:**
```typescript
interface ClickOptions {offset?: Offset;} ```typescript
``` interface ClickOptions {
offset?: Offset;
}
```

View File

@ -1,22 +1,24 @@
--- ---
sidebar_label: CommonEventEmitter.addListener sidebar_label: CommonEventEmitter.addListener
--- ---
# CommonEventEmitter.addListener() method
# CommonEventEmitter.addListener() method
**Signature:**
**Signature:**
```typescript
interface CommonEventEmitter {addListener(event: EventType, handler: Handler): CommonEventEmitter;} ```typescript
``` interface CommonEventEmitter {
addListener(event: EventType, handler: Handler): CommonEventEmitter;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| event | [EventType](./puppeteer.eventtype.md) | |
| handler | [Handler](./puppeteer.handler.md) | | | Parameter | Type | Description |
| --------- | ------------------------------------- | ----------- |
**Returns:** | event | [EventType](./puppeteer.eventtype.md) | |
| handler | [Handler](./puppeteer.handler.md) | |
[CommonEventEmitter](./puppeteer.commoneventemitter.md)
**Returns:**
[CommonEventEmitter](./puppeteer.commoneventemitter.md)

View File

@ -1,22 +1,24 @@
--- ---
sidebar_label: CommonEventEmitter.emit sidebar_label: CommonEventEmitter.emit
--- ---
# CommonEventEmitter.emit() method
# CommonEventEmitter.emit() method
**Signature:**
**Signature:**
```typescript
interface CommonEventEmitter {emit(event: EventType, eventData?: unknown): boolean;} ```typescript
``` interface CommonEventEmitter {
emit(event: EventType, eventData?: unknown): boolean;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| event | [EventType](./puppeteer.eventtype.md) | |
| eventData | unknown | <i>(Optional)</i> | | Parameter | Type | Description |
| --------- | ------------------------------------- | ----------------- |
**Returns:** | event | [EventType](./puppeteer.eventtype.md) | |
| eventData | unknown | <i>(Optional)</i> |
boolean
**Returns:**
boolean

View File

@ -1,21 +1,23 @@
--- ---
sidebar_label: CommonEventEmitter.listenerCount sidebar_label: CommonEventEmitter.listenerCount
--- ---
# CommonEventEmitter.listenerCount() method
# CommonEventEmitter.listenerCount() method
**Signature:**
**Signature:**
```typescript
interface CommonEventEmitter {listenerCount(event: string): number;} ```typescript
``` interface CommonEventEmitter {
listenerCount(event: string): number;
## Parameters }
```
| Parameter | Type | Description |
| --- | --- | --- | ## Parameters
| event | string | |
| Parameter | Type | Description |
**Returns:** | --------- | ------ | ----------- |
| event | string | |
number
**Returns:**
number

Some files were not shown because too many files have changed in this diff Show More