mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(docs): generate site for v10.0.0
* fix: added parts of website * fix: removed unnecessary lines * fix: updated contributing.md * fix: added parts of sidebar * fix: added all APIs * fix: added version 10.0.0 Co-authored-by: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
parent
3cfacee850
commit
34ff00e2fe
@ -201,7 +201,9 @@ export interface ScreenshotOptions {
|
||||
* @public
|
||||
*/
|
||||
export const enum PageEmittedEvents {
|
||||
/** Emitted when the page closes. */
|
||||
/** Emitted when the page closes.
|
||||
* @eventProperty
|
||||
*/
|
||||
Close = 'close',
|
||||
/**
|
||||
* Emitted when JavaScript within the page calls one of console API methods,
|
||||
|
@ -22,7 +22,7 @@ module.exports = {
|
||||
tagline: 'Note: this documentation is WIP. Please use https://pptr.dev.',
|
||||
url: 'https://puppeteer.github.io/',
|
||||
baseUrl: '/puppeteer/',
|
||||
onBrokenLinks: 'ignore',
|
||||
onBrokenLinks: 'warn',
|
||||
onBrokenMarkdownLinks: 'ignore',
|
||||
favicon: 'img/favicon.ico',
|
||||
organizationName: 'puppeteer', // Usually your GitHub org/user name.
|
||||
@ -48,6 +48,9 @@ module.exports = {
|
||||
label: 'Contribute',
|
||||
position: 'left',
|
||||
},
|
||||
{
|
||||
type: 'docsVersionDropdown',
|
||||
},
|
||||
{
|
||||
label: 'Github',
|
||||
href: 'https://github.com/puppeteer/puppeteer',
|
||||
|
@ -471,6 +471,11 @@ module.exports = {
|
||||
id: 'puppeteer.page.metrics',
|
||||
label: 'metrics',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
id: 'puppeteer.page.once',
|
||||
label: 'once',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
id: 'puppeteer.page.pdf',
|
||||
|
12
website/versioned_docs/version-10.0.0/index.md
Normal file
12
website/versioned_docs/version-10.0.0/index.md
Normal file
@ -0,0 +1,12 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md)
|
||||
|
||||
## API Reference
|
||||
|
||||
## Packages
|
||||
|
||||
| Package | Description |
|
||||
| --- | --- |
|
||||
| [puppeteer](./puppeteer.md) | |
|
||||
|
@ -0,0 +1,30 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Accessibility](./puppeteer.accessibility.md)
|
||||
|
||||
## 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).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class Accessibility
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output.
|
||||
|
||||
Blink - Chrome's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree.
|
||||
|
||||
Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Accessibility` class.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [snapshot(options)](./puppeteer.accessibility.snapshot.md) | | Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. |
|
||||
|
@ -0,0 +1,61 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Accessibility](./puppeteer.accessibility.md) > [snapshot](./puppeteer.accessibility.snapshot.md)
|
||||
|
||||
## Accessibility.snapshot() method
|
||||
|
||||
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[SerializedAXNode](./puppeteer.serializedaxnode.md)>
|
||||
|
||||
An AXNode object representing the snapshot.
|
||||
|
||||
## Remarks
|
||||
|
||||
\*\*NOTE\*\* The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Puppeteer will discard them as well for an easier to process tree, unless `interestingOnly` is set to `false`.
|
||||
|
||||
## Example 1
|
||||
|
||||
An example of dumping the entire accessibility tree:
|
||||
|
||||
```js
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
console.log(snapshot);
|
||||
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of logging the focused node's name:
|
||||
|
||||
```js
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
const node = findFocusedNode(snapshot);
|
||||
console.log(node && node.name);
|
||||
|
||||
function findFocusedNode(node) {
|
||||
if (node.focused)
|
||||
return node;
|
||||
for (const child of node.children || []) {
|
||||
const foundNode = findFocusedNode(child);
|
||||
return foundNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,12 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ActionResult](./puppeteer.actionresult.md)
|
||||
|
||||
## ActionResult type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type ActionResult = 'continue' | 'abort' | 'respond';
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoundingBox](./puppeteer.boundingbox.md) > [height](./puppeteer.boundingbox.height.md)
|
||||
|
||||
## BoundingBox.height property
|
||||
|
||||
the height of the element in pixels.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
height: number;
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoundingBox](./puppeteer.boundingbox.md)
|
||||
|
||||
## BoundingBox interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BoundingBox
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | 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. |
|
||||
| [x](./puppeteer.boundingbox.x.md) | number | the x coordinate of the element in pixels. |
|
||||
| [y](./puppeteer.boundingbox.y.md) | number | the y coordinate of the element in pixels. |
|
||||
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoundingBox](./puppeteer.boundingbox.md) > [width](./puppeteer.boundingbox.width.md)
|
||||
|
||||
## BoundingBox.width property
|
||||
|
||||
the width of the element in pixels.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
width: number;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoundingBox](./puppeteer.boundingbox.md) > [x](./puppeteer.boundingbox.x.md)
|
||||
|
||||
## BoundingBox.x property
|
||||
|
||||
the x coordinate of the element in pixels.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
x: number;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoundingBox](./puppeteer.boundingbox.md) > [y](./puppeteer.boundingbox.y.md)
|
||||
|
||||
## BoundingBox.y property
|
||||
|
||||
the y coordinate of the element in pixels.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
y: number;
|
||||
```
|
@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [border](./puppeteer.boxmodel.border.md)
|
||||
|
||||
## BoxModel.border property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
border: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
```
|
@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [content](./puppeteer.boxmodel.content.md)
|
||||
|
||||
## BoxModel.content property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
content: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [height](./puppeteer.boxmodel.height.md)
|
||||
|
||||
## BoxModel.height property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
height: number;
|
||||
```
|
@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [margin](./puppeteer.boxmodel.margin.md)
|
||||
|
||||
## BoxModel.margin property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
margin: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
```
|
24
website/versioned_docs/version-10.0.0/puppeteer.boxmodel.md
Normal file
24
website/versioned_docs/version-10.0.0/puppeteer.boxmodel.md
Normal file
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md)
|
||||
|
||||
## BoxModel interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BoxModel
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [border](./puppeteer.boxmodel.border.md) | Array<{ x: number; y: number; }> | |
|
||||
| [content](./puppeteer.boxmodel.content.md) | Array<{ x: number; y: number; }> | |
|
||||
| [height](./puppeteer.boxmodel.height.md) | number | |
|
||||
| [margin](./puppeteer.boxmodel.margin.md) | Array<{ x: number; y: number; }> | |
|
||||
| [padding](./puppeteer.boxmodel.padding.md) | Array<{ x: number; y: number; }> | |
|
||||
| [width](./puppeteer.boxmodel.width.md) | number | |
|
||||
|
@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [padding](./puppeteer.boxmodel.padding.md)
|
||||
|
||||
## BoxModel.padding property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
padding: Array<{
|
||||
x: number;
|
||||
y: number;
|
||||
}>;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BoxModel](./puppeteer.boxmodel.md) > [width](./puppeteer.boxmodel.width.md)
|
||||
|
||||
## BoxModel.width property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
width: number;
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [browserContexts](./puppeteer.browser.browsercontexts.md)
|
||||
|
||||
## 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).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
browserContexts(): BrowserContext[];
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md)\[\]
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [close](./puppeteer.browser.close.md)
|
||||
|
||||
## 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.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
close(): Promise<void>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
@ -0,0 +1,33 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [createIncognitoBrowserContext](./puppeteer.browser.createincognitobrowsercontext.md)
|
||||
|
||||
## Browser.createIncognitoBrowserContext() method
|
||||
|
||||
Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
createIncognitoBrowserContext(): Promise<BrowserContext>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[BrowserContext](./puppeteer.browsercontext.md)>
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
// Create a new incognito browser context.
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page in a pristine context.
|
||||
const page = await context.newPage();
|
||||
// Do stuff
|
||||
await page.goto('https://example.com');
|
||||
})();
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [defaultBrowserContext](./puppeteer.browser.defaultbrowsercontext.md)
|
||||
|
||||
## Browser.defaultBrowserContext() method
|
||||
|
||||
Returns the default browser context. The default browser context cannot be closed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
defaultBrowserContext(): BrowserContext;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[BrowserContext](./puppeteer.browsercontext.md)
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [disconnect](./puppeteer.browser.disconnect.md)
|
||||
|
||||
## 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.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
disconnect(): void;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
void
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [isConnected](./puppeteer.browser.isconnected.md)
|
||||
|
||||
## Browser.isConnected() method
|
||||
|
||||
Indicates that the browser is connected.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
isConnected(): boolean;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
boolean
|
||||
|
79
website/versioned_docs/version-10.0.0/puppeteer.browser.md
Normal file
79
website/versioned_docs/version-10.0.0/puppeteer.browser.md
Normal file
@ -0,0 +1,79 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md)
|
||||
|
||||
## 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).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class Browser extends EventEmitter
|
||||
```
|
||||
<b>Extends:</b> [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserEmittedEvents](./puppeteer.browseremittedevents.md) enum.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Browser` class.
|
||||
|
||||
## Example 1
|
||||
|
||||
An example of using a [Browser](./puppeteer.browser.md) to create a [Page](./puppeteer.page.md):
|
||||
|
||||
```js
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://example.com');
|
||||
await browser.close();
|
||||
})();
|
||||
|
||||
```
|
||||
|
||||
## Example 2
|
||||
|
||||
An example of disconnecting from and reconnecting to a [Browser](./puppeteer.browser.md):
|
||||
|
||||
```js
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
// Store the endpoint to be able to reconnect to Chromium
|
||||
const browserWSEndpoint = browser.wsEndpoint();
|
||||
// Disconnect puppeteer from Chromium
|
||||
browser.disconnect();
|
||||
|
||||
// Use the endpoint to reestablish a connection
|
||||
const browser2 = await puppeteer.connect({browserWSEndpoint});
|
||||
// Close Chromium
|
||||
await browser2.close();
|
||||
})();
|
||||
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md). |
|
||||
| [close()](./puppeteer.browser.close.md) | | Closes Chromium and all of its pages (if any were opened). The [Browser](./puppeteer.browser.md) object itself is considered to be disposed and cannot be used anymore. |
|
||||
| [createIncognitoBrowserContext()](./puppeteer.browser.createincognitobrowsercontext.md) | | Creates a new incognito browser context. This won't share cookies/cache with other browser contexts. |
|
||||
| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Returns the default browser context. The default browser context cannot be closed. |
|
||||
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling <code>disconnect</code>, the [Browser](./puppeteer.browser.md) object is considered disposed and cannot be used anymore. |
|
||||
| [isConnected()](./puppeteer.browser.isconnected.md) | | Indicates that the browser is connected. |
|
||||
| [newPage()](./puppeteer.browser.newpage.md) | | Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context. |
|
||||
| [pages()](./puppeteer.browser.pages.md) | | An array of all open pages inside the Browser. |
|
||||
| [process()](./puppeteer.browser.process.md) | | The spawned browser process. Returns <code>null</code> if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
||||
| [target()](./puppeteer.browser.target.md) | | The target associated with the browser. |
|
||||
| [targets()](./puppeteer.browser.targets.md) | | All active targets inside the Browser. In case of multiple browser contexts, returns an array with all the targets in all browser contexts. |
|
||||
| [userAgent()](./puppeteer.browser.useragent.md) | | The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md). |
|
||||
| [version()](./puppeteer.browser.version.md) | | A string representing the browser name and version. |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md) | | Searches for a target in all browser contexts. |
|
||||
| [wsEndpoint()](./puppeteer.browser.wsendpoint.md) | | The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md). |
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [newPage](./puppeteer.browser.newpage.md)
|
||||
|
||||
## Browser.newPage() method
|
||||
|
||||
Promise which resolves to a new [Page](./puppeteer.page.md) object. The Page is created in a default browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
newPage(): Promise<Page>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)>
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [pages](./puppeteer.browser.pages.md)
|
||||
|
||||
## Browser.pages() method
|
||||
|
||||
An array of all open pages inside the Browser.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
pages(): Promise<Page[]>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)\[\]>
|
||||
|
||||
## Remarks
|
||||
|
||||
In case of multiple browser contexts, returns an array with all the pages in all browser contexts. Non-visible pages, such as `"background_page"`, will not be listed here. You can find them using [Target.page()](./puppeteer.target.page.md).
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [process](./puppeteer.browser.process.md)
|
||||
|
||||
## Browser.process() method
|
||||
|
||||
The spawned browser process. Returns `null` if the browser instance was created with [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
process(): ChildProcess | null;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
ChildProcess \| null
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [target](./puppeteer.browser.target.md)
|
||||
|
||||
## Browser.target() method
|
||||
|
||||
The target associated with the browser.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
target(): Target;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Target](./puppeteer.target.md)
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [targets](./puppeteer.browser.targets.md)
|
||||
|
||||
## 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.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
targets(): Target[];
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Target](./puppeteer.target.md)\[\]
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [userAgent](./puppeteer.browser.useragent.md)
|
||||
|
||||
## Browser.userAgent() method
|
||||
|
||||
The browser's original user agent. Pages can override the browser user agent with [Page.setUserAgent()](./puppeteer.page.setuseragent.md).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
userAgent(): Promise<string>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<string>
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [version](./puppeteer.browser.version.md)
|
||||
|
||||
## Browser.version() method
|
||||
|
||||
A string representing the browser name and version.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
version(): Promise<string>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<string>
|
||||
|
||||
## Remarks
|
||||
|
||||
For headless Chromium, this is similar to `HeadlessChrome/61.0.3153.0`. For non-headless, this is similar to `Chrome/61.0.3153.0`.
|
||||
|
||||
The format of browser.version() might change with future releases of Chromium.
|
||||
|
@ -0,0 +1,37 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [waitForTarget](./puppeteer.browser.waitfortarget.md)
|
||||
|
||||
## Browser.waitForTarget() method
|
||||
|
||||
Searches for a target in all browser contexts.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
waitForTarget(predicate: (x: Target) => boolean, options?: WaitForTargetOptions): Promise<Target>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| predicate | (x: [Target](./puppeteer.target.md)) => boolean | A function to be run for every target. |
|
||||
| options | [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Target](./puppeteer.target.md)>
|
||||
|
||||
The first target found that matches the `predicate` function.
|
||||
|
||||
## Example
|
||||
|
||||
An example of finding a target for a page opened via `window.open`:
|
||||
|
||||
```js
|
||||
await page.evaluate(() => window.open('https://www.example.com/'));
|
||||
const newWindowTarget = await browser.waitForTarget(target => target.url() === 'https://www.example.com/');
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,25 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Browser](./puppeteer.browser.md) > [wsEndpoint](./puppeteer.browser.wsendpoint.md)
|
||||
|
||||
## Browser.wsEndpoint() method
|
||||
|
||||
The browser websocket endpoint which can be used as an argument to [Puppeteer.connect()](./puppeteer.puppeteer.connect.md).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
wsEndpoint(): string;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
string
|
||||
|
||||
The Browser websocket url.
|
||||
|
||||
## Remarks
|
||||
|
||||
The format is `ws://${host}:${port}/devtools/browser/<id>`.
|
||||
|
||||
You can find the `webSocketDebuggerUrl` from `http://${host}:${port}/json/version`. Learn more about the [devtools protocol](https://chromedevtools.github.io/devtools-protocol) and the [browser endpoint](https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target).
|
||||
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) > [defaultViewport](./puppeteer.browserconnectoptions.defaultviewport.md)
|
||||
|
||||
## BrowserConnectOptions.defaultViewport property
|
||||
|
||||
Sets the viewport for each page.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
defaultViewport?: Viewport | null;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) > [ignoreHTTPSErrors](./puppeteer.browserconnectoptions.ignorehttpserrors.md)
|
||||
|
||||
## BrowserConnectOptions.ignoreHTTPSErrors property
|
||||
|
||||
Whether to ignore HTTPS errors during navigation.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
ignoreHTTPSErrors?: boolean;
|
||||
```
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserConnectOptions](./puppeteer.browserconnectoptions.md)
|
||||
|
||||
## BrowserConnectOptions interface
|
||||
|
||||
Generic browser options that can be passed when launching any browser or when connecting to an existing browser instance.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BrowserConnectOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | [Viewport](./puppeteer.viewport.md) \| null | <i>(Optional)</i> Sets the viewport for each page. |
|
||||
| [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | boolean | <i>(Optional)</i> Whether to ignore HTTPS errors during navigation. |
|
||||
| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | number | <i>(Optional)</i> Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. |
|
||||
| [targetFilter?](./puppeteer.browserconnectoptions.targetfilter.md) | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | <i>(Optional)</i> Callback to decide if Puppeteer should connect to a given target or not. |
|
||||
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) > [slowMo](./puppeteer.browserconnectoptions.slowmo.md)
|
||||
|
||||
## BrowserConnectOptions.slowMo property
|
||||
|
||||
Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
slowMo?: number;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserConnectOptions](./puppeteer.browserconnectoptions.md) > [targetFilter](./puppeteer.browserconnectoptions.targetfilter.md)
|
||||
|
||||
## BrowserConnectOptions.targetFilter property
|
||||
|
||||
Callback to decide if Puppeteer should connect to a given target or not.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
targetFilter?: TargetFilterCallback;
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [browser](./puppeteer.browsercontext.browser.md)
|
||||
|
||||
## BrowserContext.browser() method
|
||||
|
||||
The browser this browser context belongs to.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
browser(): Browser;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Browser](./puppeteer.browser.md)
|
||||
|
@ -0,0 +1,28 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [clearPermissionOverrides](./puppeteer.browsercontext.clearpermissionoverrides.md)
|
||||
|
||||
## BrowserContext.clearPermissionOverrides() method
|
||||
|
||||
Clears all permission overrides for the browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
clearPermissionOverrides(): Promise<void>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
const context = browser.defaultBrowserContext();
|
||||
context.overridePermissions('https://example.com', ['clipboard-read']);
|
||||
// do stuff ..
|
||||
context.clearPermissionOverrides();
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [close](./puppeteer.browsercontext.close.md)
|
||||
|
||||
## BrowserContext.close() method
|
||||
|
||||
Closes the browser context. All the targets that belong to the browser context will be closed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
close(): Promise<void>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Remarks
|
||||
|
||||
Only incognito browser contexts can be closed.
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [isIncognito](./puppeteer.browsercontext.isincognito.md)
|
||||
|
||||
## BrowserContext.isIncognito() method
|
||||
|
||||
Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
isIncognito(): boolean;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
boolean
|
||||
|
||||
## Remarks
|
||||
|
||||
The default browser context cannot be closed.
|
||||
|
@ -0,0 +1,54 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md)
|
||||
|
||||
## 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.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class BrowserContext extends EventEmitter
|
||||
```
|
||||
<b>Extends:</b> [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
The Browser class extends from Puppeteer's [EventEmitter](./puppeteer.eventemitter.md) class and will emit various events which are documented in the [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md) enum.
|
||||
|
||||
If a page opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's browser context.
|
||||
|
||||
Puppeteer allows creation of "incognito" browser contexts with [Browser.createIncognitoBrowserContext](./puppeteer.browser.createincognitobrowsercontext.md) method. "Incognito" browser contexts don't write any browsing data to disk.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserContext` class.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
// Create a new incognito browser context
|
||||
const context = await browser.createIncognitoBrowserContext();
|
||||
// Create a new page inside context.
|
||||
const page = await context.newPage();
|
||||
// ... do stuff with page ...
|
||||
await page.goto('https://example.com');
|
||||
// Dispose context once it's no longer needed.
|
||||
await context.close();
|
||||
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [browser()](./puppeteer.browsercontext.browser.md) | | The browser this browser context belongs to. |
|
||||
| [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for the browser context. |
|
||||
| [close()](./puppeteer.browsercontext.close.md) | | Closes the browser context. All the targets that belong to the browser context will be closed. |
|
||||
| [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context. |
|
||||
| [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new page in the browser context. |
|
||||
| [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | |
|
||||
| [pages()](./puppeteer.browsercontext.pages.md) | | An array of all pages inside the browser context. |
|
||||
| [targets()](./puppeteer.browsercontext.targets.md) | | An array of all active targets inside the browser context. |
|
||||
| [waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md) | | This searches for a target in this specific browser context. |
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [newPage](./puppeteer.browsercontext.newpage.md)
|
||||
|
||||
## BrowserContext.newPage() method
|
||||
|
||||
Creates a new page in the browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
newPage(): Promise<Page>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)>
|
||||
|
@ -0,0 +1,32 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [overridePermissions](./puppeteer.browsercontext.overridepermissions.md)
|
||||
|
||||
## BrowserContext.overridePermissions() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
overridePermissions(origin: string, permissions: Permission[]): Promise<void>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| origin | string | The origin to grant permissions to, e.g. "https://example.com". |
|
||||
| permissions | [Permission](./puppeteer.permission.md)\[\] | An array of permissions to grant. All permissions that are not listed here will be automatically denied. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
const context = browser.defaultBrowserContext();
|
||||
await context.overridePermissions('https://html5demos.com', ['geolocation']);
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,19 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [pages](./puppeteer.browsercontext.pages.md)
|
||||
|
||||
## BrowserContext.pages() method
|
||||
|
||||
An array of all pages inside the browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
pages(): Promise<Page[]>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Page](./puppeteer.page.md)\[\]>
|
||||
|
||||
Promise which resolves to an array of all open pages. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [the target page](./puppeteer.target.page.md).
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [targets](./puppeteer.browsercontext.targets.md)
|
||||
|
||||
## BrowserContext.targets() method
|
||||
|
||||
An array of all active targets inside the browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
targets(): Target[];
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Target](./puppeteer.target.md)\[\]
|
||||
|
@ -0,0 +1,39 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContext](./puppeteer.browsercontext.md) > [waitForTarget](./puppeteer.browsercontext.waitfortarget.md)
|
||||
|
||||
## BrowserContext.waitForTarget() method
|
||||
|
||||
This searches for a target in this specific browser context.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
waitForTarget(predicate: (x: Target) => boolean, options?: {
|
||||
timeout?: number;
|
||||
}): Promise<Target>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| predicate | (x: [Target](./puppeteer.target.md)) => boolean | A function to be run for every target |
|
||||
| options | { timeout?: number; } | 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. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[Target](./puppeteer.target.md)>
|
||||
|
||||
Promise which resolves to the first target found that matches the `predicate` function.
|
||||
|
||||
## Example
|
||||
|
||||
An example of finding a target for a page opened via `window.open`:
|
||||
|
||||
```js
|
||||
await page.evaluate(() => window.open('https://www.example.com/'));
|
||||
const newWindowTarget = await browserContext.waitForTarget(target => target.url() === 'https://www.example.com/');
|
||||
|
||||
```
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserContextEmittedEvents](./puppeteer.browsercontextemittedevents.md)
|
||||
|
||||
## BrowserContextEmittedEvents enum
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare const enum BrowserContextEmittedEvents
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
| Member | Value | Description |
|
||||
| --- | --- | --- |
|
||||
| TargetChanged | <code>"targetchanged"</code> | Emitted when the url of a target inside the browser context changes. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetCreated | <code>"targetcreated"</code> | 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)Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetDestroyed | <code>"targetdestroyed"</code> | Emitted when a target is destroyed within the browser context, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserEmittedEvents](./puppeteer.browseremittedevents.md)
|
||||
|
||||
## BrowserEmittedEvents enum
|
||||
|
||||
All the events a [browser instance](./puppeteer.browser.md) may emit.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare const enum BrowserEmittedEvents
|
||||
```
|
||||
|
||||
## Enumeration Members
|
||||
|
||||
| Member | Value | Description |
|
||||
| --- | --- | --- |
|
||||
| Disconnected | <code>"disconnected"</code> | Emitted when Puppeteer gets disconnected from the Chromium instance. This might happen because of one of the following:- Chromium is closed or crashed- The [browser.disconnect](./puppeteer.browser.disconnect.md) method was called. |
|
||||
| TargetChanged | <code>"targetchanged"</code> | Emitted when the url of a target changes. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetCreated | <code>"targetcreated"</code> | 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)Contains a [Target](./puppeteer.target.md) instance. |
|
||||
| TargetDestroyed | <code>"targetdestroyed"</code> | Emitted when a target is destroyed, for example when a page is closed. Contains a [Target](./puppeteer.target.md) instance. |
|
||||
|
@ -0,0 +1,30 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [canDownload](./puppeteer.browserfetcher.candownload.md)
|
||||
|
||||
## BrowserFetcher.canDownload() method
|
||||
|
||||
Initiates a HEAD request to check if the revision is available.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
canDownload(revision: string): Promise<boolean>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | The revision to check availability for. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<boolean>
|
||||
|
||||
A promise that resolves to `true` if the revision could be downloaded from the host.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
||||
|
@ -0,0 +1,31 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [download](./puppeteer.browserfetcher.download.md)
|
||||
|
||||
## BrowserFetcher.download() method
|
||||
|
||||
Initiates a GET request to download the revision from the host.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
download(revision: string, progressCallback?: (x: number, y: number) => void): Promise<BrowserFetcherRevisionInfo>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | The revision to download. |
|
||||
| progressCallback | (x: number, y: number) => void | A function that will be called with two arguments: How many bytes have been downloaded and the total number of bytes of the download. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)>
|
||||
|
||||
A promise with revision information when the revision is downloaded and extracted.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [host](./puppeteer.browserfetcher.host.md)
|
||||
|
||||
## BrowserFetcher.host() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
host(): string;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
string
|
||||
|
||||
The download host being used.
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [localRevisions](./puppeteer.browserfetcher.localrevisions.md)
|
||||
|
||||
## BrowserFetcher.localRevisions() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
localRevisions(): Promise<string[]>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<string\[\]>
|
||||
|
||||
A promise with a list of all revision strings (for the current `product`) available locally on disk.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
||||
|
@ -0,0 +1,45 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md)
|
||||
|
||||
## BrowserFetcher class
|
||||
|
||||
BrowserFetcher can download and manage different versions of Chromium and Firefox.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class BrowserFetcher
|
||||
```
|
||||
|
||||
## Remarks
|
||||
|
||||
BrowserFetcher operates on revision strings that specify a precise version of Chromium, e.g. `"533271"`. Revision strings can be obtained from [omahaproxy.appspot.com](http://omahaproxy.appspot.com/). In the Firefox case, BrowserFetcher downloads Firefox Nightly and operates on version numbers such as `"75"`.
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BrowserFetcher` class.
|
||||
|
||||
## Example
|
||||
|
||||
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
|
||||
|
||||
```js
|
||||
const browserFetcher = puppeteer.createBrowserFetcher();
|
||||
const revisionInfo = await browserFetcher.download('533271');
|
||||
const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath})
|
||||
|
||||
```
|
||||
\*\*NOTE\*\* BrowserFetcher is not designed to work concurrently with other instances of BrowserFetcher that share the same downloads directory.
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [canDownload(revision)](./puppeteer.browserfetcher.candownload.md) | | Initiates a HEAD request to check if the revision is available. |
|
||||
| [download(revision, progressCallback)](./puppeteer.browserfetcher.download.md) | | Initiates a GET request to download the revision from the host. |
|
||||
| [host()](./puppeteer.browserfetcher.host.md) | | |
|
||||
| [localRevisions()](./puppeteer.browserfetcher.localrevisions.md) | | |
|
||||
| [platform()](./puppeteer.browserfetcher.platform.md) | | |
|
||||
| [product()](./puppeteer.browserfetcher.product.md) | | |
|
||||
| [remove(revision)](./puppeteer.browserfetcher.remove.md) | | |
|
||||
| [revisionInfo(revision)](./puppeteer.browserfetcher.revisioninfo.md) | | |
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [platform](./puppeteer.browserfetcher.platform.md)
|
||||
|
||||
## BrowserFetcher.platform() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
platform(): Platform;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Platform](./puppeteer.platform.md)
|
||||
|
||||
Returns the current `Platform`, which is one of `mac`, `linux`, `win32` or `win64`.
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [product](./puppeteer.browserfetcher.product.md)
|
||||
|
||||
## BrowserFetcher.product() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
product(): Product;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Product](./puppeteer.product.md)
|
||||
|
||||
Returns the current `Product`, which is one of `chrome` or `firefox`.
|
||||
|
@ -0,0 +1,28 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [remove](./puppeteer.browserfetcher.remove.md)
|
||||
|
||||
## BrowserFetcher.remove() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
remove(revision: string): Promise<void>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | A revision to remove for the current <code>product</code>. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
||||
A promise that resolves when the revision has been removes or throws if the revision has not been downloaded.
|
||||
|
||||
## Remarks
|
||||
|
||||
This method is affected by the current `product`.
|
||||
|
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcher](./puppeteer.browserfetcher.md) > [revisionInfo](./puppeteer.browserfetcher.revisioninfo.md)
|
||||
|
||||
## BrowserFetcher.revisionInfo() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
revisionInfo(revision: string): BrowserFetcherRevisionInfo;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| revision | string | The revision to get info for. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)
|
||||
|
||||
The revision info for the given revision.
|
||||
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) > [host](./puppeteer.browserfetcheroptions.host.md)
|
||||
|
||||
## BrowserFetcherOptions.host property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
host?: string;
|
||||
```
|
@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md)
|
||||
|
||||
## BrowserFetcherOptions interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BrowserFetcherOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [host?](./puppeteer.browserfetcheroptions.host.md) | string | <i>(Optional)</i> |
|
||||
| [path?](./puppeteer.browserfetcheroptions.path.md) | string | <i>(Optional)</i> |
|
||||
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> |
|
||||
| [product?](./puppeteer.browserfetcheroptions.product.md) | string | <i>(Optional)</i> |
|
||||
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) > [path](./puppeteer.browserfetcheroptions.path.md)
|
||||
|
||||
## BrowserFetcherOptions.path property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
path?: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) > [platform](./puppeteer.browserfetcheroptions.platform.md)
|
||||
|
||||
## BrowserFetcherOptions.platform property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
platform?: Platform;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) > [product](./puppeteer.browserfetcheroptions.product.md)
|
||||
|
||||
## BrowserFetcherOptions.product property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
product?: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.executablePath property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
executablePath: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.folderPath property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
folderPath: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [local](./puppeteer.browserfetcherrevisioninfo.local.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.local property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
local: boolean;
|
||||
```
|
@ -0,0 +1,24 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BrowserFetcherRevisionInfo
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [executablePath](./puppeteer.browserfetcherrevisioninfo.executablepath.md) | string | |
|
||||
| [folderPath](./puppeteer.browserfetcherrevisioninfo.folderpath.md) | string | |
|
||||
| [local](./puppeteer.browserfetcherrevisioninfo.local.md) | boolean | |
|
||||
| [product](./puppeteer.browserfetcherrevisioninfo.product.md) | string | |
|
||||
| [revision](./puppeteer.browserfetcherrevisioninfo.revision.md) | string | |
|
||||
| [url](./puppeteer.browserfetcherrevisioninfo.url.md) | string | |
|
||||
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [product](./puppeteer.browserfetcherrevisioninfo.product.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.product property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
product: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [revision](./puppeteer.browserfetcherrevisioninfo.revision.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.revision property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
revision: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserFetcherRevisionInfo](./puppeteer.browserfetcherrevisioninfo.md) > [url](./puppeteer.browserfetcherrevisioninfo.url.md)
|
||||
|
||||
## BrowserFetcherRevisionInfo.url property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
url: string;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) > [args](./puppeteer.browserlaunchargumentoptions.args.md)
|
||||
|
||||
## BrowserLaunchArgumentOptions.args property
|
||||
|
||||
Additional command line arguments to pass to the browser instance.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
args?: string[];
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) > [devtools](./puppeteer.browserlaunchargumentoptions.devtools.md)
|
||||
|
||||
## BrowserLaunchArgumentOptions.devtools property
|
||||
|
||||
Whether to auto-open a DevTools panel for each tab. If this is set to `true`, then `headless` will be set to `false` automatically.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
devtools?: boolean;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) > [headless](./puppeteer.browserlaunchargumentoptions.headless.md)
|
||||
|
||||
## BrowserLaunchArgumentOptions.headless property
|
||||
|
||||
Whether to run the browser in headless mode.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
headless?: boolean;
|
||||
```
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md)
|
||||
|
||||
## BrowserLaunchArgumentOptions interface
|
||||
|
||||
Launcher options that only apply to Chrome.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface BrowserLaunchArgumentOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [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 set to <code>false</code> automatically. |
|
||||
| [headless?](./puppeteer.browserlaunchargumentoptions.headless.md) | boolean | <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/+/master/docs/user_data_dir.md) for more info. |
|
||||
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [BrowserLaunchArgumentOptions](./puppeteer.browserlaunchargumentoptions.md) > [userDataDir](./puppeteer.browserlaunchargumentoptions.userdatadir.md)
|
||||
|
||||
## BrowserLaunchArgumentOptions.userDataDir property
|
||||
|
||||
Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) for more info.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
userDataDir?: string;
|
||||
```
|
@ -0,0 +1,15 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSession](./puppeteer.cdpsession.md) > [connection](./puppeteer.cdpsession.connection.md)
|
||||
|
||||
## CDPSession.connection() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
connection(): Connection;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
[Connection](./puppeteer.connection.md)
|
||||
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSession](./puppeteer.cdpsession.md) > [detach](./puppeteer.cdpsession.detach.md)
|
||||
|
||||
## 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.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
detach(): Promise<void>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<void>
|
||||
|
@ -0,0 +1,46 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSession](./puppeteer.cdpsession.md)
|
||||
|
||||
## CDPSession class
|
||||
|
||||
The `CDPSession` instances are used to talk raw Chrome Devtools Protocol.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class CDPSession extends EventEmitter
|
||||
```
|
||||
<b>Extends:</b> [EventEmitter](./puppeteer.eventemitter.md)
|
||||
|
||||
## Remarks
|
||||
|
||||
Protocol methods can be called with [CDPSession.send()](./puppeteer.cdpsession.send.md) method and protocol events can be subscribed to with `CDPSession.on` method.
|
||||
|
||||
Useful links: [DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/) and [Getting Started with DevTools Protocol](https://github.com/aslushnikov/getting-started-with-cdp/blob/master/README.md).
|
||||
|
||||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `CDPSession` class.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
```js
|
||||
const client = await page.target().createCDPSession();
|
||||
await client.send('Animation.enable');
|
||||
client.on('Animation.animationCreated', () => console.log('Animation created!'));
|
||||
const response = await client.send('Animation.getPlaybackRate');
|
||||
console.log('playback rate is ' + response.playbackRate);
|
||||
await client.send('Animation.setPlaybackRate', {
|
||||
playbackRate: response.playbackRate / 2
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [connection()](./puppeteer.cdpsession.connection.md) | | |
|
||||
| [detach()](./puppeteer.cdpsession.detach.md) | | Detaches the cdpSession from the target. Once detached, the cdpSession object won't emit any events and can't be used to send messages. |
|
||||
| [send(method, paramArgs)](./puppeteer.cdpsession.send.md) | | |
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSession](./puppeteer.cdpsession.md) > [send](./puppeteer.cdpsession.send.md)
|
||||
|
||||
## CDPSession.send() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
send<T extends keyof ProtocolMapping.Commands>(method: T, ...paramArgs: ProtocolMapping.Commands[T]['paramsType']): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| method | T | |
|
||||
| paramArgs | ProtocolMapping.Commands\[T\]\['paramsType'\] | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
Promise<ProtocolMapping.Commands\[T\]\['returnType'\]>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) > [error](./puppeteer.cdpsessiononmessageobject.error.md)
|
||||
|
||||
## CDPSessionOnMessageObject.error property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
error: {
|
||||
message: string;
|
||||
data: any;
|
||||
};
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) > [id](./puppeteer.cdpsessiononmessageobject.id.md)
|
||||
|
||||
## CDPSessionOnMessageObject.id property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
id?: number;
|
||||
```
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md)
|
||||
|
||||
## CDPSessionOnMessageObject interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface CDPSessionOnMessageObject
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [error](./puppeteer.cdpsessiononmessageobject.error.md) | { message: string; data: any; } | |
|
||||
| [id?](./puppeteer.cdpsessiononmessageobject.id.md) | number | <i>(Optional)</i> |
|
||||
| [method](./puppeteer.cdpsessiononmessageobject.method.md) | string | |
|
||||
| [params](./puppeteer.cdpsessiononmessageobject.params.md) | Record<string, unknown> | |
|
||||
| [result?](./puppeteer.cdpsessiononmessageobject.result.md) | any | <i>(Optional)</i> |
|
||||
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) > [method](./puppeteer.cdpsessiononmessageobject.method.md)
|
||||
|
||||
## CDPSessionOnMessageObject.method property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
method: string;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) > [params](./puppeteer.cdpsessiononmessageobject.params.md)
|
||||
|
||||
## CDPSessionOnMessageObject.params property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
params: Record<string, unknown>;
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) > [result](./puppeteer.cdpsessiononmessageobject.result.md)
|
||||
|
||||
## CDPSessionOnMessageObject.result property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
result?: any;
|
||||
```
|
@ -0,0 +1,12 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md)
|
||||
|
||||
## ChromeReleaseChannel type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type ChromeReleaseChannel = 'chrome' | 'chrome-beta' | 'chrome-canary' | 'chrome-dev';
|
||||
```
|
@ -0,0 +1,17 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [clearCustomQueryHandlers](./puppeteer.clearcustomqueryhandlers.md)
|
||||
|
||||
## clearCustomQueryHandlers() function
|
||||
|
||||
Clears all registered handlers.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare function clearCustomQueryHandlers(): void;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
void
|
||||
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ClickOptions](./puppeteer.clickoptions.md) > [button](./puppeteer.clickoptions.button.md)
|
||||
|
||||
## ClickOptions.button property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
button?: 'left' | 'right' | 'middle';
|
||||
```
|
@ -0,0 +1,11 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ClickOptions](./puppeteer.clickoptions.md) > [clickCount](./puppeteer.clickoptions.clickcount.md)
|
||||
|
||||
## ClickOptions.clickCount property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
clickCount?: number;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ClickOptions](./puppeteer.clickoptions.md) > [delay](./puppeteer.clickoptions.delay.md)
|
||||
|
||||
## ClickOptions.delay property
|
||||
|
||||
Time to wait between `mousedown` and `mouseup` in milliseconds.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
delay?: number;
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ClickOptions](./puppeteer.clickoptions.md)
|
||||
|
||||
## ClickOptions interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface ClickOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [button?](./puppeteer.clickoptions.button.md) | 'left' \| 'right' \| 'middle' | <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. |
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md) > [addListener](./puppeteer.commoneventemitter.addlistener.md)
|
||||
|
||||
## CommonEventEmitter.addListener() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
addListener(event: EventType, handler: Handler): CommonEventEmitter;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| event | [EventType](./puppeteer.eventtype.md) | |
|
||||
| handler | [Handler](./puppeteer.handler.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[CommonEventEmitter](./puppeteer.commoneventemitter.md)
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md) > [emit](./puppeteer.commoneventemitter.emit.md)
|
||||
|
||||
## CommonEventEmitter.emit() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
emit(event: EventType, eventData?: unknown): boolean;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| event | [EventType](./puppeteer.eventtype.md) | |
|
||||
| eventData | unknown | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
boolean
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md) > [listenerCount](./puppeteer.commoneventemitter.listenercount.md)
|
||||
|
||||
## CommonEventEmitter.listenerCount() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
listenerCount(event: string): number;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| event | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
number
|
||||
|
@ -0,0 +1,26 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md)
|
||||
|
||||
## CommonEventEmitter interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface CommonEventEmitter
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Description |
|
||||
| --- | --- |
|
||||
| [addListener(event, handler)](./puppeteer.commoneventemitter.addlistener.md) | |
|
||||
| [emit(event, eventData)](./puppeteer.commoneventemitter.emit.md) | |
|
||||
| [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | |
|
||||
| [off(event, handler)](./puppeteer.commoneventemitter.off.md) | |
|
||||
| [on(event, handler)](./puppeteer.commoneventemitter.on.md) | |
|
||||
| [once(event, handler)](./puppeteer.commoneventemitter.once.md) | |
|
||||
| [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | |
|
||||
| [removeListener(event, handler)](./puppeteer.commoneventemitter.removelistener.md) | |
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md) > [off](./puppeteer.commoneventemitter.off.md)
|
||||
|
||||
## CommonEventEmitter.off() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
off(event: EventType, handler: Handler): CommonEventEmitter;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| event | [EventType](./puppeteer.eventtype.md) | |
|
||||
| handler | [Handler](./puppeteer.handler.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[CommonEventEmitter](./puppeteer.commoneventemitter.md)
|
||||
|
@ -0,0 +1,23 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [CommonEventEmitter](./puppeteer.commoneventemitter.md) > [on](./puppeteer.commoneventemitter.on.md)
|
||||
|
||||
## CommonEventEmitter.on() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
on(event: EventType, handler: Handler): CommonEventEmitter;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| event | [EventType](./puppeteer.eventtype.md) | |
|
||||
| handler | [Handler](./puppeteer.handler.md) | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
[CommonEventEmitter](./puppeteer.commoneventemitter.md)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user