chore: release main (#12252)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This commit is contained in:
release-please[bot] 2024-04-11 16:51:07 +00:00 committed by GitHub
parent f75756cd38
commit 75f170b26d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
606 changed files with 2304 additions and 2114 deletions

View File

@ -1,6 +1,6 @@
{
"packages/puppeteer": "22.6.3",
"packages/puppeteer-core": "22.6.3",
"packages/puppeteer": "22.6.4",
"packages/puppeteer-core": "22.6.4",
"packages/testserver": "0.6.0",
"packages/ng-schematics": "0.6.0",
"packages/browsers": "2.2.1"

View File

@ -10,6 +10,7 @@ The following versions of the browsers are supported, mapped to Puppeteer versio
<!-- version-start -->
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 123.0.6312.122 - [Puppeteer v22.6.4](https://github.com/puppeteer/puppeteer/blob/puppeteer-v22.6.4/docs/api/index.md)
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 123.0.6312.105 - [Puppeteer v22.6.3](https://github.com/puppeteer/puppeteer/blob/puppeteer-v22.6.3/docs/api/index.md)
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 123.0.6312.86 - [Puppeteer v22.6.2](https://github.com/puppeteer/puppeteer/blob/puppeteer-v22.6.2/docs/api/index.md)
- [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) 123.0.6312.58 - [Puppeteer v22.6.0](https://github.com/puppeteer/puppeteer/blob/puppeteer-v22.6.0/docs/api/index.md)

6
package-lock.json generated
View File

@ -12235,14 +12235,14 @@
}
},
"packages/puppeteer": {
"version": "22.6.3",
"version": "22.6.4",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "2.2.1",
"cosmiconfig": "9.0.0",
"devtools-protocol": "0.0.1262051",
"puppeteer-core": "22.6.3"
"puppeteer-core": "22.6.4"
},
"bin": {
"puppeteer": "lib/esm/puppeteer/node/cli.js"
@ -12255,7 +12255,7 @@
}
},
"packages/puppeteer-core": {
"version": "22.6.3",
"version": "22.6.4",
"license": "Apache-2.0",
"dependencies": {
"@puppeteer/browsers": "2.2.1",

View File

@ -20,6 +20,16 @@ All notable changes to this project will be documented in this file. See [standa
* dependencies
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0
## [22.6.4](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v22.6.3...puppeteer-core-v22.6.4) (2024-04-11)
### Bug Fixes
* **a11y:** query only unignored nodes ([#12224](https://github.com/puppeteer/puppeteer/issues/12224)) ([e20cd64](https://github.com/puppeteer/puppeteer/commit/e20cd64fff374c4113777912c193f4a5d7d04297))
* retain stale main frame for longer ([#12225](https://github.com/puppeteer/puppeteer/issues/12225)) ([aa5b182](https://github.com/puppeteer/puppeteer/commit/aa5b1824a5c82005fcfc05b002facfbbb9810f8f))
* roll to Chrome 123.0.6312.122 (r1262506) ([#12248](https://github.com/puppeteer/puppeteer/issues/12248)) ([50b6659](https://github.com/puppeteer/puppeteer/commit/50b66591e70a7b6907d86594d7dacee6e76afc2d))
* **webdriver:** suppress error for error code errors ([5f7254c](https://github.com/puppeteer/puppeteer/commit/5f7254c41c7c1bda82477488f10254d204373d54))
## [22.6.3](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v22.6.2...puppeteer-core-v22.6.3) (2024-04-05)

View File

@ -1,6 +1,6 @@
{
"name": "puppeteer-core",
"version": "22.6.3",
"version": "22.6.4",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
"keywords": [
"puppeteer",

View File

@ -29,6 +29,20 @@ All notable changes to this project will be documented in this file. See [standa
* puppeteer-core bumped from 21.0.2 to 21.0.3
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0
## [22.6.4](https://github.com/puppeteer/puppeteer/compare/puppeteer-v22.6.3...puppeteer-v22.6.4) (2024-04-11)
### Miscellaneous Chores
* **puppeteer:** Synchronize puppeteer versions
### Dependencies
* The following workspace dependencies were updated
* dependencies
* puppeteer-core bumped from 22.6.3 to 22.6.4
## [22.6.3](https://github.com/puppeteer/puppeteer/compare/puppeteer-v22.6.2...puppeteer-v22.6.3) (2024-04-05)

View File

@ -1,6 +1,6 @@
{
"name": "puppeteer",
"version": "22.6.3",
"version": "22.6.4",
"description": "A high-level API to control headless Chrome over the DevTools Protocol",
"keywords": [
"puppeteer",
@ -124,7 +124,7 @@
"license": "Apache-2.0",
"dependencies": {
"cosmiconfig": "9.0.0",
"puppeteer-core": "22.6.3",
"puppeteer-core": "22.6.4",
"@puppeteer/browsers": "2.2.1",
"devtools-protocol": "0.0.1262051"
},

View File

@ -7,7 +7,7 @@
const versionsPerRelease = new Map([
// This is a mapping from Chrome version => Puppeteer version.
// In Chrome roll patches, use `NEXT` for the Puppeteer version.
['123.0.6312.122', 'NEXT'],
['123.0.6312.122', 'v22.6.4'],
['123.0.6312.105', 'v22.6.3'],
['123.0.6312.86', 'v22.6.2'],
['123.0.6312.58', 'v22.6.0'],

View File

@ -1,66 +0,0 @@
---
sidebar_label: CommonEventEmitter
---
# CommonEventEmitter interface
#### Signature:
```typescript
export interface CommonEventEmitter<Events extends Record<EventType, unknown>>
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[emit(type, event)](./puppeteer.commoneventemitter.emit.md)
</td><td>
</td></tr>
<tr><td>
[listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md)
</td><td>
</td></tr>
<tr><td>
[off(type, handler)](./puppeteer.commoneventemitter.off.md)
</td><td>
</td></tr>
<tr><td>
[on(type, handler)](./puppeteer.commoneventemitter.on.md)
</td><td>
</td></tr>
<tr><td>
[once(type, handler)](./puppeteer.commoneventemitter.once.md)
</td><td>
</td></tr>
<tr><td>
[removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md)
</td><td>
</td></tr>
</tbody></table>

View File

@ -1,308 +0,0 @@
---
sidebar_label: API
---
# @puppeteer/browsers
Manage and launch browsers/drivers from a CLI or programmatically.
## CLI
Use `npx` to run the CLI:
```bash
npx @puppeteer/browsers --help
```
CLI help will provide all documentation you need to use the CLI.
```bash
npx @puppeteer/browsers --help # help for all commands
npx @puppeteer/browsers install --help # help for the install command
npx @puppeteer/browsers launch --help # help for the launch command
```
## Known limitations
1. We support installing and running Firefox, Chrome and Chromium. The `latest`, `beta`, `dev`, `canary`, `stable` keywords are only supported for the install command. For the `launch` command you need to specify an exact build ID. The build ID is provided by the `install` command (see `npx @puppeteer/browsers install --help` for the format).
2. Launching the system browsers is only possible for Chrome/Chromium.
## API
The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install`, `canInstall`, `launch`, `computeExecutablePath`, `computeSystemExecutablePath` and other methods.
## Classes
<table><thead><tr><th>
Class
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[CLI](./browsers.cli.md)
</td><td>
</td></tr>
<tr><td>
[InstalledBrowser](./browsers.installedbrowser.md)
</td><td>
</td></tr>
<tr><td>
[Process](./browsers.process.md)
</td><td>
</td></tr>
<tr><td>
[TimeoutError](./browsers.timeouterror.md)
</td><td>
</td></tr>
</tbody></table>
## Enumerations
<table><thead><tr><th>
Enumeration
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[Browser](./browsers.browser.md)
</td><td>
Supported browsers.
</td></tr>
<tr><td>
[BrowserPlatform](./browsers.browserplatform.md)
</td><td>
Platform names used to identify a OS platform x architecture combination in the way that is relevant for the browser download.
</td></tr>
<tr><td>
[ChromeReleaseChannel](./browsers.chromereleasechannel.md)
</td><td>
</td></tr>
</tbody></table>
## Functions
<table><thead><tr><th>
Function
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[canDownload(options)](./browsers.candownload.md)
</td><td>
</td></tr>
<tr><td>
[computeExecutablePath(options)](./browsers.computeexecutablepath.md)
</td><td>
</td></tr>
<tr><td>
[computeSystemExecutablePath(options)](./browsers.computesystemexecutablepath.md)
</td><td>
</td></tr>
<tr><td>
[createProfile(browser, opts)](./browsers.createprofile.md)
</td><td>
</td></tr>
<tr><td>
[detectBrowserPlatform()](./browsers.detectbrowserplatform.md)
</td><td>
</td></tr>
<tr><td>
[getInstalledBrowsers(options)](./browsers.getinstalledbrowsers.md)
</td><td>
Returns metadata about browsers installed in the cache directory.
</td></tr>
<tr><td>
[getVersionComparator(browser)](./browsers.getversioncomparator.md)
</td><td>
Returns a version comparator for the given browser that can be used to sort browser versions.
</td></tr>
<tr><td>
[install(options)](./browsers.install.md)
</td><td>
</td></tr>
<tr><td>
[install(options)](./browsers.install_1.md)
</td><td>
</td></tr>
<tr><td>
[launch(opts)](./browsers.launch.md)
</td><td>
</td></tr>
<tr><td>
[makeProgressCallback(browser, buildId)](./browsers.makeprogresscallback.md)
</td><td>
</td></tr>
<tr><td>
[resolveBuildId(browser, platform, tag)](./browsers.resolvebuildid.md)
</td><td>
</td></tr>
<tr><td>
[uninstall(options)](./browsers.uninstall.md)
</td><td>
</td></tr>
</tbody></table>
## Interfaces
<table><thead><tr><th>
Interface
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md)
</td><td>
</td></tr>
<tr><td>
[InstallOptions](./browsers.installoptions.md)
</td><td>
</td></tr>
<tr><td>
[LaunchOptions](./browsers.launchoptions.md)
</td><td>
</td></tr>
<tr><td>
[Options](./browsers.options.md)
</td><td>
</td></tr>
<tr><td>
[ProfileOptions](./browsers.profileoptions.md)
</td><td>
</td></tr>
<tr><td>
[SystemOptions](./browsers.systemoptions.md)
</td><td>
</td></tr>
<tr><td>
[UninstallOptions](./browsers.uninstalloptions.md)
</td><td>
</td></tr>
</tbody></table>
## Variables
<table><thead><tr><th>
Variable
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md)
</td><td>
</td></tr>
<tr><td>
[WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md)
</td><td>
</td></tr>
</tbody></table>

View File

@ -1,170 +0,0 @@
# Locators
Locators is a new, experimental API that combines the functionalities of
waiting and actions. With additional precondition checks, it
enables automatic retries for failed actions, resulting in more reliable and
less flaky automation scripts.
:::note
Locators API is experimental and we will not follow semver for breaking changes
in the Locators API.
:::
## Use cases
### Waiting for an element
```ts
await page.locator('button').wait();
```
The following preconditions are automatically checked:
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
### Waiting for a function
```ts
await page
.locator(() => {
let resolve!: (node: HTMLCanvasElement) => void;
const promise = new Promise(res => {
return (resolve = res);
});
const observer = new MutationObserver(records => {
for (const record of records) {
if (record.target instanceof HTMLCanvasElement) {
resolve(record.target);
}
}
});
observer.observe(document);
return promise;
})
.wait();
```
### Clicking an element
```ts
await page.locator('button').click();
```
The following preconditions are automatically checked:
- Ensures the element is in the viewport.
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
- Waits for the element to become enabled.
- Waits for the element to have a stable bounding box over two consecutive
animation frames.
### Clicking an element matching a criteria
```ts
await page
.locator('button')
.filter(button => !button.disabled)
.click();
```
The following preconditions are automatically checked:
- Ensures the element is in the viewport.
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
- Waits for the element to become enabled.
- Waits for the element to have a stable bounding box over two consecutive
animation frames.
### Filling out an input
```ts
await page.locator('input').fill('value');
```
Automatically detects the input type and choose an appropriate way to fill it out with the provided value.
The following preconditions are automatically checked:
- Ensures the element is in the viewport.
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
- Waits for the element to become enabled.
- Waits for the element to have a stable bounding box over two consecutive
animation frames.
### Retrieving an element property
```ts
const enabled = await page
.locator('button')
.map(button => !button.disabled)
.wait();
```
### Hover over an element
```ts
await page.locator('div').hover();
```
The following preconditions are automatically checked:
- Ensures the element is in the viewport.
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
- Waits for the element to have a stable bounding box over two consecutive
animation frames.
### Scroll an element
```ts
await page.locator('div').scroll({
scrollLeft: 10,
scrollTop: 20,
});
```
The following preconditions are automatically checked:
- Ensures the element is in the viewport.
- Waits for the element to become
[visible](https://pptr.dev/api/puppeteer.elementhandle.isvisible/) or hidden.
- Waits for the element to have a stable bounding box over two consecutive
animation frames.
## Configuring locators
Locators can be configured to tune configure the preconditions and other other options:
```ts
await page
.locator('button')
.setEnsureElementIsInTheViewport(false)
.setTimeout(0)
.setVisibility(null)
.setWaitForEnabled(false)
.setWaitForStableBoundingBox(false)
.click();
```
## Getting locator events
Currently, locators support a single event that notifies you when the locator is about to perform the action:
```ts
let willClick = false;
await page
.locator('button')
.on(LocatorEvent.Action, () => {
willClick = true;
})
.click();
```
This event can be used for logging/debugging or other purposes. The event might
fire multiple times if the locator retries the action.

View File

@ -1,118 +0,0 @@
# Query Selectors (legacy)
Queries are the primary mechanism for interacting with the DOM on your site. For example, a typical workflow goes like:
```ts
// Import puppeteer
import puppeteer from 'puppeteer';
(async () => {
// Launch the browser
const browser = await puppeteer.launch();
// Create a page
const page = await browser.newPage();
// Go to your site
await page.goto('YOUR_SITE');
// Query for an element handle.
const element = await page.waitForSelector('div > .class-name');
// Do something with element...
await element.click(); // Just an example.
// Dispose of handle
await element.dispose();
// Close browser.
await browser.close();
})();
```
## CSS
CSS selectors follow the CSS spec of the browser being automated. We provide some basic type deduction for CSS selectors (such as `HTMLInputElement` for `input`), but any selector that contains no type information (such as `.class-name`) will need to be coerced manually using TypeScript's `as` coercion mechanism.
### Example
```ts
// Automatic
const element = await page.waitForSelector('div > input');
// Manual
const element = (await page.waitForSelector(
'div > .class-name-for-input'
)) as HTMLInputElement;
```
## Built-in selectors
Built-in selectors are Puppeteer's own class of selectors for doing things CSS cannot. Every built-in selector starts with a prefix `.../` to assist Puppeteer in distinguishing between CSS selectors and a built-in.
### Text selectors (`text/`)
Text selectors will select "minimal" elements containing the given text, even within (open) shadow roots. Here, "minimum" means the deepest elements that contain a given text, but not their parents (which technically will also contain the given text).
#### Example
```ts
// Note we usually need type coercion since the type cannot be deduced, but for text selectors, `instanceof` checks may be better for runtime validation.
const element = await page.waitForSelector('text/My name is Jun');
```
### XPath selectors (`xpath/`)
XPath selectors will use the browser's native [`Document.evaluate`](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) to query for elements.
#### Example
```ts
// There is not type deduction for XPaths.
const node = await page.waitForSelector('xpath/h2');
```
### ARIA selectors (`aria/`)
ARIA selectors can be used to find elements with a given ARIA label. These labels are computed using Chrome's internal representation.
#### Example
```ts
const node = await page.waitForSelector('aria/Button name');
```
### Pierce selectors (`pierce/`)
Pierce selectors will run the `querySelector*` API on the document and all shadow roots to find an element.
:::danger
Selectors will **not** _partially_ pierce through shadow roots. See the examples below.
:::
#### Example
Suppose the HTML is
```html
<div>
<custom-element>
<div></div>
</custom-element>
</div>
```
Then
```ts
// This will be two elements because of the outer and inner div.
expect((await page.$$('pierce/div')).length).toBe(2);
// Partial piercing doesn't work.
expect((await page.$$('pierce/div div')).length).toBe(0);
```
## Custom selectors
Puppeteer provides users the ability to add their own query selectors to Puppeteer using [Puppeteer.registerCustomQueryHandler](../api/puppeteer.registercustomqueryhandler.md). This is useful for creating custom selectors based on framework objects or other vendor-specific objects.

View File

@ -1,213 +0,0 @@
# Query Selectors
Queries are the primary mechanism for interacting with the DOM on your site. For example, a typical workflow goes like:
```ts
// Import puppeteer
import puppeteer from 'puppeteer';
(async () => {
// Launch the browser
const browser = await puppeteer.launch();
// Create a page
const page = await browser.newPage();
// Go to your site
await page.goto('YOUR_SITE');
// Query for an element handle.
const element = await page.waitForSelector('div > .class-name');
// Do something with element...
await element.click(); // Just an example.
// Dispose of handle
await element.dispose();
// Close browser.
await browser.close();
})();
```
## `P` Selectors
Puppeteer uses a superset of the CSS selector syntax for querying. We call this syntax _P selectors_ and it's supercharged with extra capabilities such as deep combinators and text selection.
:::caution
Although P selectors look like real CSS selectors (we intentionally designed it this way), they should not be used for actually CSS styling. They are designed only for Puppeteer.
:::
:::note
P selectors only work on the first "depth" of selectors; for example, `:is(div >>> a)` will not work.
:::
### `>>>` and `>>>>` combinators
The `>>>` and `>>>>` are called _deep descendent_ and _deep_ combinators respectively. Both combinators have the effect of going into shadow hosts with `>>>` going into every shadow host under a node and `>>>>` going into the immediate one (if the node is a shadow host; otherwise, it's a no-op).
:::note
A common question is when should `>>>>` be chosen over `>>>` considering the flexibility of `>>>`. A similar question can be asked about `>` and a space; choose `>` if you do not need to query all elements under a given node and a space otherwise. This answer extends to `>>>>` (`>`) and `>>>` (space) naturally.
:::
#### Example
Suppose we have the markup
```html
<custom-element>
<template shadowrootmode="open">
<slot></slot>
</template>
<custom-element>
<template shadowrootmode="open">
<slot></slot>
</template>
<custom-element>
<template shadowrootmode="open">
<slot></slot>
</template>
<h2>Light content</h2>
</custom-element>
</custom-element>
</custom-element>
```
> Note: `<template shadowrootmode="open">` is not supported on Firefox.
> You can read more about it [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template#attributes).
Then `custom-element >>> h2` will return `h2`, but `custom-element >>>> h2` will return nothing since the inner `h2` is in a deeper shadow root.
### `P`-elements
`P` elements are [pseudo-elements](https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements) with a `-p` vendor prefix. It allows you to enhance your selectors with Puppeteer-specific query engines such as XPath, text queries, and ARIA.
#### Text selectors (`-p-text`)
Text selectors will select "minimal" elements containing the given text, even within (open) shadow roots. Here, "minimum" means the deepest elements that contain a given text, but not their parents (which technically will also contain the given text).
##### Example
```ts
const element = await page.waitForSelector('div ::-p-text(My name is Jun)');
// You can also use escapes.
const element = await page.waitForSelector(
':scope >>> ::-p-text(My name is Jun \\(pronounced like "June"\\))'
);
// or quotes
const element = await page.waitForSelector(
'div >>>> ::-p-text("My name is Jun (pronounced like \\"June\\")"):hover'
);
```
#### XPath selectors (`-p-xpath`)
XPath selectors will use the browser's native [`Document.evaluate`](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) to query for elements.
##### Example
```ts
const element = await page.waitForSelector('::-p-xpath(h2)');
```
#### ARIA selectors (`-p-aria`)
ARIA selectors can be used to find elements with a given ARIA label. These labels are computed using Chrome's internal representation.
##### Example
```ts
const node = await page.waitForSelector('::-p-aria(Submit)');
const node = await page.waitForSelector(
'::-p-aria([name="Click me"][role="button"])'
);
```
### Custom selectors
Puppeteer provides users the ability to add their own query selectors to Puppeteer using [Puppeteer.registerCustomQueryHandler](../api/puppeteer.registercustomqueryhandler.md). This is useful for creating custom selectors based on framework objects or other vendor-specific objects.
#### Custom Selectors
You can register a custom query handler that allows you to create custom selectors. For example, define a query handler for `getById` selectors:
```ts
Puppeteer.registerCustomQueryHandler('getById', {
queryOne: (elementOrDocument, selector) => {
return elementOrDocument.querySelector(`[id="${CSS.escape(selector)}"]`);
},
// Note: for demonstation perpose only `id` should be page unique
queryAll: (elementOrDocument, selector) => {
return elementOrDocument.querySelectorAll(`[id="${CSS.escape(selector)}"]`);
},
});
```
You can now use it as following:
```ts
const node = await page.waitForSelector('::-p-getById(elementId)');
// OR used in conjunction with other selectors
const moreSpecificNode = await page.waitForSelector(
'.side-bar ::-p-getById(elementId)'
);
```
#### Custom framework components selector
:::caution
Be careful when relying on internal APIs of libraries or frameworks. They can change at any time.
:::
Find Vue components by name by using Vue internals for querying:
```ts
Puppeteer.registerCustomQueryHandler('vue', {
queryOne: (element, name) => {
const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT);
do {
const currentNode = walker.currentNode;
if (
currentNode.__vnode?.ctx?.type?.name.toLowerCase() ===
name.toLocaleLowerCase()
) {
return currentNode;
}
} while (walker.nextNode());
return null;
},
});
```
Query the Vue component as following:
```ts
const element = await page.$('::-p-vue(MyComponent)');
```
#### Web Components
Web Components create their own tag so you can query them by the tag name:
```ts
const element = await page.$('my-web-component');
```
Extend `HTMLElementTagNameMap` to define types for custom tags. This allows Puppeteer to infer the return type for the ElementHandle:
```ts
declare global {
interface HTMLElementTagNameMap {
'my-web-component': MyWebComponent;
}
}
```

View File

@ -1,261 +0,0 @@
# Puppeteer
[![build](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml)
[![npm puppeteer package](https://img.shields.io/npm/v/puppeteer.svg)](https://npmjs.org/package/puppeteer)
<img src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png" height="200" align="right"/>
#### [Guides](https://pptr.dev/category/guides) | [API](https://pptr.dev/api) | [FAQ](https://pptr.dev/faq) | [Contributing](https://pptr.dev/contributing) | [Troubleshooting](https://pptr.dev/troubleshooting)
> Puppeteer is a Node.js library which provides a high-level API to control
> Chrome/Chromium over the
> [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).
> Puppeteer runs in
> [headless](https://developer.chrome.com/docs/chromium/new-headless/)
> mode by default, but can be configured to run in full ("headful")
> Chrome/Chromium.
#### What can I do?
Most things that you can do manually in the browser can be done using Puppeteer!
Here are a few examples to get you started:
- Generate screenshots and PDFs of pages.
- Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e.
"SSR" (Server-Side Rendering)).
- Automate form submission, UI testing, keyboard input, etc.
- Create an automated testing environment using the latest JavaScript and
browser features.
- Capture a
[timeline trace](https://developer.chrome.com/docs/devtools/performance/reference)
of your site to help diagnose performance issues.
- [Test Chrome Extensions](https://pptr.dev/guides/chrome-extensions).
## Getting Started
### Installation
To use Puppeteer in your project, run:
```bash
npm i puppeteer
# or using yarn
yarn add puppeteer
# or using pnpm
pnpm i puppeteer
```
When you install Puppeteer, it automatically downloads a recent version of
[Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) (~170MB macOS, ~282MB Linux, ~280MB Windows) and a `chrome-headless-shell` binary (starting with Puppeteer v21.6.0) that is [guaranteed to
work](https://pptr.dev/faq#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy)
with Puppeteer. The browser is downloaded to the `$HOME/.cache/puppeteer` folder
by default (starting with Puppeteer v19.0.0). See [configuration](https://pptr.dev/api/puppeteer.configuration) for configuration options and environmental variables to control the download behavior.
If you deploy a project using Puppeteer to a hosting provider, such as Render or
Heroku, you might need to reconfigure the location of the cache to be within
your project folder (see an example below) because not all hosting providers
include `$HOME/.cache` into the project's deployment.
For a version of Puppeteer without the browser installation, see
[`puppeteer-core`](#puppeteer-core).
If used with TypeScript, the minimum supported TypeScript version is `4.7.4`.
#### Configuration
Puppeteer uses several defaults that can be customized through configuration
files.
For example, to change the default cache directory Puppeteer uses to install
browsers, you can add a `.puppeteerrc.cjs` (or `puppeteer.config.cjs`) at the
root of your application with the contents
```js
const {join} = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
```
After adding the configuration file, you will need to remove and reinstall
`puppeteer` for it to take effect.
See the [configuration guide](https://pptr.dev/guides/configuration) for more
information.
#### `puppeteer-core`
For every release since v1.7.0 we publish two packages:
- [`puppeteer`](https://www.npmjs.com/package/puppeteer)
- [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core)
`puppeteer` is a _product_ for browser automation. When installed, it downloads
a version of Chrome, which it then drives using `puppeteer-core`. Being an
end-user product, `puppeteer` automates several workflows using reasonable
defaults [that can be customized](https://pptr.dev/guides/configuration).
`puppeteer-core` is a _library_ to help drive anything that supports DevTools
protocol. Being a library, `puppeteer-core` is fully driven through its
programmatic interface implying no defaults are assumed and `puppeteer-core`
will not download Chrome when installed.
You should use `puppeteer-core` if you are
[connecting to a remote browser](https://pptr.dev/api/puppeteer.puppeteer.connect)
or [managing browsers yourself](https://pptr.dev/browsers-api/).
If you are managing browsers yourself, you will need to call
[`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) with
an explicit
[`executablePath`](https://pptr.dev/api/puppeteer.launchoptions)
(or [`channel`](https://pptr.dev/api/puppeteer.launchoptions) if it's
installed in a standard location).
When using `puppeteer-core`, remember to change the import:
```ts
import puppeteer from 'puppeteer-core';
```
### Usage
Puppeteer follows the latest
[maintenance LTS](https://github.com/nodejs/Release#release-schedule) version of
Node.
Puppeteer will be familiar to people using other browser testing frameworks. You
[launch](https://pptr.dev/api/puppeteer.puppeteernode.launch)/[connect](https://pptr.dev/api/puppeteer.puppeteernode.connect)
a [browser](https://pptr.dev/api/puppeteer.browser),
[create](https://pptr.dev/api/puppeteer.browser.newpage) some
[pages](https://pptr.dev/api/puppeteer.page), and then manipulate them with
[Puppeteer's API](https://pptr.dev/api).
For more in-depth usage, check our [guides](https://pptr.dev/category/guides)
and [examples](https://github.com/puppeteer/puppeteer/tree/main/examples).
#### Example
The following example searches [developer.chrome.com](https://developer.chrome.com/) for blog posts with text "automate beyond recorder", click on the first result and print the full title of the blog post.
```ts
import puppeteer from 'puppeteer';
(async () => {
// Launch the browser and open a new blank page
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Navigate the page to a URL
await page.goto('https://developer.chrome.com/');
// Set screen size
await page.setViewport({width: 1080, height: 1024});
// Type into search box
await page.type('.devsite-search-field', 'automate beyond recorder');
// Wait and click on first result
const searchResultSelector = '.devsite-result-item-link';
await page.waitForSelector(searchResultSelector);
await page.click(searchResultSelector);
// Locate the full title with a unique string
const textSelector = await page.waitForSelector(
'text/Customize and automate'
);
const fullTitle = await textSelector?.evaluate(el => el.textContent);
// Print the full title
console.log('The title of this blog post is "%s".', fullTitle);
await browser.close();
})();
```
### Default runtime settings
**1. Uses Headless mode**
By default Puppeteer launches Chrome in
[the Headless mode](https://developer.chrome.com/docs/chromium/new-headless/).
```ts
const browser = await puppeteer.launch();
// Equivalent to
const browser = await puppeteer.launch({headless: true});
```
Before v22, Puppeteer launched the [old Headless mode](https://developer.chrome.com/docs/chromium/new-headless/) by default.
The old headless mode is now known as
[`chrome-headless-shell`](https://developer.chrome.com/blog/chrome-headless-shell)
and ships as a separate binary. `chrome-headless-shell` does not match the
behavior of the regular Chrome completely but it is currently more performant
for automation tasks where the complete Chrome feature set is not needed. If the performance
is more important for your use case, switch to `chrome-headless-shell` as following:
```ts
const browser = await puppeteer.launch({headless: 'shell'});
```
To launch a "headful" version of Chrome, set the
[`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions) to `false`
option when launching a browser:
```ts
const browser = await puppeteer.launch({headless: false});
```
**2. Runs a bundled version of Chrome**
By default, Puppeteer downloads and uses a specific version of Chrome so its
API is guaranteed to work out of the box. To use Puppeteer with a different
version of Chrome or Chromium, pass in the executable's path when creating a
`Browser` instance:
```ts
const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});
```
You can also use Puppeteer with Firefox. See
[status of cross-browser support](https://pptr.dev/faq#q-what-is-the-status-of-cross-browser-support) for
more information.
See
[`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/)
for a description of the differences between Chromium and Chrome.
[`This article`](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/chromium_browser_vs_google_chrome.md)
describes some differences for Linux users.
**3. Creates a fresh user profile**
Puppeteer creates its own browser user profile which it **cleans up on every
run**.
#### Using Docker
See our [Docker guide](https://pptr.dev/guides/docker).
#### Using Chrome Extensions
See our [Chrome extensions guide](https://pptr.dev/guides/chrome-extensions).
## Resources
- [API Documentation](https://pptr.dev/api)
- [Guides](https://pptr.dev/category/guides)
- [Examples](https://github.com/puppeteer/puppeteer/tree/main/examples)
- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)
## Contributing
Check out our [contributing guide](https://pptr.dev/contributing) to get an
overview of Puppeteer development.
## FAQ
Our [FAQ](https://pptr.dev/faq) has migrated to
[our site](https://pptr.dev/faq).

View File

@ -39,7 +39,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[snapshot(options)](./puppeteer.accessibility.snapshot.md)
<span id="snapshot">[snapshot(options)](./puppeteer.accessibility.snapshot.md)</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
signal
<span id="signal">signal</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
creditCard
<span id="creditcard">creditCard</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
height
<span id="height">height</span>
</td><td>
@ -54,7 +54,7 @@ the height of the element in pixels.
</td></tr>
<tr><td>
width
<span id="width">width</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
border
<span id="border">border</span>
</td><td>
@ -50,7 +50,7 @@ border
</td></tr>
<tr><td>
content
<span id="content">content</span>
</td><td>
@ -65,7 +65,7 @@ content
</td></tr>
<tr><td>
height
<span id="height">height</span>
</td><td>
@ -80,7 +80,7 @@ number
</td></tr>
<tr><td>
margin
<span id="margin">margin</span>
</td><td>
@ -95,7 +95,7 @@ margin
</td></tr>
<tr><td>
padding
<span id="padding">padding</span>
</td><td>
@ -110,7 +110,7 @@ padding
</td></tr>
<tr><td>
width
<span id="width">width</span>
</td><td>

View File

@ -8,7 +8,7 @@ sidebar_label: Browser
- connected to via [Puppeteer.connect()](./puppeteer.puppeteer.connect.md) or - launched by [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md).
[Browser](./puppeteer.browser.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserEvent](./puppeteer.browserevent.md) enum.
[Browser](./puppeteer.browser.md) [emits](./puppeteer.eventemitter.emit.md) various events which are documented in the [BrowserEvent](./puppeteer.browserevent.md) enum.
#### Signature:
@ -75,7 +75,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
connected
<span id="connected">connected</span>
</td><td>
@ -92,7 +92,7 @@ Whether Puppeteer is connected to this [browser](./puppeteer.browser.md).
</td></tr>
<tr><td>
debugInfo
<span id="debuginfo">debugInfo</span>
</td><td>
@ -126,7 +126,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[browserContexts()](./puppeteer.browser.browsercontexts.md)
<span id="browsercontexts">[browserContexts()](./puppeteer.browser.browsercontexts.md)</span>
</td><td>
@ -139,7 +139,7 @@ In a newly-created [browser](./puppeteer.browser.md), this will return a single
</td></tr>
<tr><td>
[close()](./puppeteer.browser.close.md)
<span id="close">[close()](./puppeteer.browser.close.md)</span>
</td><td>
@ -150,7 +150,7 @@ Closes this [browser](./puppeteer.browser.md) and all associated [pages](./puppe
</td></tr>
<tr><td>
[createBrowserContext(options)](./puppeteer.browser.createbrowsercontext.md)
<span id="createbrowsercontext">[createBrowserContext(options)](./puppeteer.browser.createbrowsercontext.md)</span>
</td><td>
@ -163,7 +163,7 @@ This won't share cookies/cache with other [browser contexts](./puppeteer.browser
</td></tr>
<tr><td>
[defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md)
<span id="defaultbrowsercontext">[defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md)</span>
</td><td>
@ -174,7 +174,7 @@ Gets the default [browser context](./puppeteer.browsercontext.md).
</td></tr>
<tr><td>
[disconnect()](./puppeteer.browser.disconnect.md)
<span id="disconnect">[disconnect()](./puppeteer.browser.disconnect.md)</span>
</td><td>
@ -185,7 +185,7 @@ Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves th
</td></tr>
<tr><td>
[isConnected()](./puppeteer.browser.isconnected.md)
<span id="isconnected">[isConnected()](./puppeteer.browser.isconnected.md)</span>
</td><td>
@ -202,7 +202,7 @@ Use [Browser.connected](./puppeteer.browser.md).
</td></tr>
<tr><td>
[newPage()](./puppeteer.browser.newpage.md)
<span id="newpage">[newPage()](./puppeteer.browser.newpage.md)</span>
</td><td>
@ -213,7 +213,7 @@ Creates a new [page](./puppeteer.page.md) in the [default browser context](./pup
</td></tr>
<tr><td>
[pages()](./puppeteer.browser.pages.md)
<span id="pages">[pages()](./puppeteer.browser.pages.md)</span>
</td><td>
@ -226,7 +226,7 @@ If there ar multiple [browser contexts](./puppeteer.browsercontext.md), this ret
</td></tr>
<tr><td>
[process()](./puppeteer.browser.process.md)
<span id="process">[process()](./puppeteer.browser.process.md)</span>
</td><td>
@ -237,7 +237,7 @@ Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#cla
</td></tr>
<tr><td>
[target()](./puppeteer.browser.target.md)
<span id="target">[target()](./puppeteer.browser.target.md)</span>
</td><td>
@ -248,7 +248,7 @@ Gets the [target](./puppeteer.target.md) associated with the [default browser co
</td></tr>
<tr><td>
[targets()](./puppeteer.browser.targets.md)
<span id="targets">[targets()](./puppeteer.browser.targets.md)</span>
</td><td>
@ -261,7 +261,7 @@ In case of multiple [browser contexts](./puppeteer.browsercontext.md), this retu
</td></tr>
<tr><td>
[userAgent()](./puppeteer.browser.useragent.md)
<span id="useragent">[userAgent()](./puppeteer.browser.useragent.md)</span>
</td><td>
@ -274,7 +274,7 @@ Gets this [browser's](./puppeteer.browser.md) original user agent.
</td></tr>
<tr><td>
[version()](./puppeteer.browser.version.md)
<span id="version">[version()](./puppeteer.browser.version.md)</span>
</td><td>
@ -289,7 +289,7 @@ The format of [Browser.version()](./puppeteer.browser.version.md) might change w
</td></tr>
<tr><td>
[waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md)
<span id="waitfortarget">[waitForTarget(predicate, options)](./puppeteer.browser.waitfortarget.md)</span>
</td><td>
@ -302,7 +302,7 @@ This will look all open [browser contexts](./puppeteer.browsercontext.md).
</td></tr>
<tr><td>
[wsEndpoint()](./puppeteer.browser.wsendpoint.md)
<span id="wsendpoint">[wsEndpoint()](./puppeteer.browser.wsendpoint.md)</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
defaultViewport
<span id="defaultviewport">defaultViewport</span>
</td><td>
@ -58,7 +58,7 @@ Sets the viewport for each page.
</td></tr>
<tr><td>
ignoreHTTPSErrors
<span id="ignorehttpserrors">ignoreHTTPSErrors</span>
</td><td>
@ -79,7 +79,7 @@ Whether to ignore HTTPS errors during navigation.
</td></tr>
<tr><td>
protocol
<span id="protocol">protocol</span>
</td><td>
@ -98,7 +98,7 @@ protocol
</td></tr>
<tr><td>
protocolTimeout
<span id="protocoltimeout">protocolTimeout</span>
</td><td>
@ -119,7 +119,7 @@ Timeout setting for individual protocol (CDP) calls.
</td></tr>
<tr><td>
slowMo
<span id="slowmo">slowMo</span>
</td><td>
@ -138,7 +138,7 @@ Slows down Puppeteer operations by the specified amount of milliseconds to aid d
</td></tr>
<tr><td>
targetFilter
<span id="targetfilter">targetFilter</span>
</td><td>

View File

@ -60,7 +60,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
closed
<span id="closed">closed</span>
</td><td>
@ -77,7 +77,7 @@ Whether this [browser context](./puppeteer.browsercontext.md) is closed.
</td></tr>
<tr><td>
id
<span id="id">id</span>
</td><td>
@ -111,7 +111,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[browser()](./puppeteer.browsercontext.browser.md)
<span id="browser">[browser()](./puppeteer.browsercontext.browser.md)</span>
</td><td>
@ -122,7 +122,7 @@ Gets the [browser](./puppeteer.browser.md) associated with this [browser context
</td></tr>
<tr><td>
[clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md)
<span id="clearpermissionoverrides">[clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md)</span>
</td><td>
@ -133,7 +133,7 @@ Clears all permission overrides for this [browser context](./puppeteer.browserco
</td></tr>
<tr><td>
[close()](./puppeteer.browsercontext.close.md)
<span id="close">[close()](./puppeteer.browsercontext.close.md)</span>
</td><td>
@ -144,7 +144,7 @@ Closes this [browser context](./puppeteer.browsercontext.md) and all associated
</td></tr>
<tr><td>
[isIncognito()](./puppeteer.browsercontext.isincognito.md)
<span id="isincognito">[isIncognito()](./puppeteer.browsercontext.isincognito.md)</span>
</td><td>
@ -163,7 +163,7 @@ In Chrome, the [default browser context](./puppeteer.browser.defaultbrowserconte
</td></tr>
<tr><td>
[newPage()](./puppeteer.browsercontext.newpage.md)
<span id="newpage">[newPage()](./puppeteer.browsercontext.newpage.md)</span>
</td><td>
@ -174,7 +174,7 @@ Creates a new [page](./puppeteer.page.md) in this [browser context](./puppeteer.
</td></tr>
<tr><td>
[overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md)
<span id="overridepermissions">[overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md)</span>
</td><td>
@ -185,7 +185,7 @@ Grants this [browser context](./puppeteer.browsercontext.md) the given `permissi
</td></tr>
<tr><td>
[pages()](./puppeteer.browsercontext.pages.md)
<span id="pages">[pages()](./puppeteer.browsercontext.pages.md)</span>
</td><td>
@ -196,7 +196,7 @@ Gets a list of all open [pages](./puppeteer.page.md) inside this [browser contex
</td></tr>
<tr><td>
[targets()](./puppeteer.browsercontext.targets.md)
<span id="targets">[targets()](./puppeteer.browsercontext.targets.md)</span>
</td><td>
@ -207,7 +207,7 @@ Gets all active [targets](./puppeteer.target.md) inside this [browser context](.
</td></tr>
<tr><td>
[waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md)
<span id="waitfortarget">[waitForTarget(predicate, options)](./puppeteer.browsercontext.waitfortarget.md)</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
targetchanged
<span id="targetchanged">targetchanged</span>
</td><td>
@ -52,7 +52,7 @@ targetchanged
</td></tr>
<tr><td>
targetcreated
<span id="targetcreated">targetcreated</span>
</td><td>
@ -67,7 +67,7 @@ targetcreated
</td></tr>
<tr><td>
targetdestroyed
<span id="targetdestroyed">targetdestroyed</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
proxyBypassList
<span id="proxybypasslist">proxyBypassList</span>
</td><td>
@ -54,7 +54,7 @@ Bypass the proxy for the given list of hosts.
</td></tr>
<tr><td>
proxyServer
<span id="proxyserver">proxyServer</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
disconnected
<span id="disconnected">disconnected</span>
</td><td>
@ -52,7 +52,7 @@ undefined
</td></tr>
<tr><td>
targetchanged
<span id="targetchanged">targetchanged</span>
</td><td>
@ -67,7 +67,7 @@ targetchanged
</td></tr>
<tr><td>
targetcreated
<span id="targetcreated">targetcreated</span>
</td><td>
@ -82,7 +82,7 @@ targetcreated
</td></tr>
<tr><td>
targetdestroyed
<span id="targetdestroyed">targetdestroyed</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
args
<span id="args">args</span>
</td><td>
@ -56,7 +56,7 @@ Additional command line arguments to pass to the browser instance.
</td></tr>
<tr><td>
debuggingPort
<span id="debuggingport">debuggingPort</span>
</td><td>
@ -75,7 +75,7 @@ Specify the debugging port number to use
</td></tr>
<tr><td>
devtools
<span id="devtools">devtools</span>
</td><td>
@ -96,7 +96,7 @@ Whether to auto-open a DevTools panel for each tab. If this is set to `true`, th
</td></tr>
<tr><td>
headless
<span id="headless">headless</span>
</td><td>
@ -117,7 +117,7 @@ Whether to run the browser in headless mode.
</td></tr>
<tr><td>
userDataDir
<span id="userdatadir">userDataDir</span>
</td><td>

View File

@ -54,7 +54,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[connection()](./puppeteer.cdpsession.connection.md)
<span id="connection">[connection()](./puppeteer.cdpsession.connection.md)</span>
</td><td>
@ -63,7 +63,7 @@ Description
</td></tr>
<tr><td>
[detach()](./puppeteer.cdpsession.detach.md)
<span id="detach">[detach()](./puppeteer.cdpsession.detach.md)</span>
</td><td>
@ -74,7 +74,7 @@ Detaches the cdpSession from the target. Once detached, the cdpSession object wo
</td></tr>
<tr><td>
[id()](./puppeteer.cdpsession.id.md)
<span id="id">[id()](./puppeteer.cdpsession.id.md)</span>
</td><td>
@ -85,7 +85,7 @@ Returns the session's id.
</td></tr>
<tr><td>
[send(method, params, options)](./puppeteer.cdpsession.send.md)
<span id="send">[send(method, params, options)](./puppeteer.cdpsession.send.md)</span>
</td><td>

View File

@ -25,14 +25,14 @@ Description
</th></tr></thead>
<tbody><tr><td>
[SessionAttached](./puppeteer.cdpsessionevent.sessionattached.md)
<span id="sessionattached">[SessionAttached](./puppeteer.cdpsessionevent.sessionattached.md)</span>
</td><td>
</td></tr>
<tr><td>
[SessionDetached](./puppeteer.cdpsessionevent.sessiondetached.md)
<span id="sessiondetached">[SessionDetached](./puppeteer.cdpsessionevent.sessiondetached.md)</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
sessionattached
<span id="sessionattached">sessionattached</span>
</td><td>
@ -52,7 +52,7 @@ sessionattached
</td></tr>
<tr><td>
sessiondetached
<span id="sessiondetached">sessiondetached</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
offset
<span id="offset">offset</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
timeout
<span id="timeout">timeout</span>
</td><td>

View File

@ -0,0 +1,66 @@
---
sidebar_label: CommonEventEmitter
---
# CommonEventEmitter interface
#### Signature:
```typescript
export interface CommonEventEmitter<Events extends Record<EventType, unknown>>
```
## Methods
<table><thead><tr><th>
Method
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
<span id="emit">[emit(type, event)](./puppeteer.commoneventemitter.emit.md)</span>
</td><td>
</td></tr>
<tr><td>
<span id="listenercount">[listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md)</span>
</td><td>
</td></tr>
<tr><td>
<span id="off">[off(type, handler)](./puppeteer.commoneventemitter.off.md)</span>
</td><td>
</td></tr>
<tr><td>
<span id="on">[on(type, handler)](./puppeteer.commoneventemitter.on.md)</span>
</td><td>
</td></tr>
<tr><td>
<span id="once">[once(type, handler)](./puppeteer.commoneventemitter.once.md)</span>
</td><td>
</td></tr>
<tr><td>
<span id="removealllisteners">[removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md)</span>
</td><td>
</td></tr>
</tbody></table>

View File

@ -39,7 +39,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
browserRevision
<span id="browserrevision">browserRevision</span>
</td><td>
@ -66,7 +66,7 @@ The pinned browser version supported by the current Puppeteer version.
</td></tr>
<tr><td>
cacheDirectory
<span id="cachedirectory">cacheDirectory</span>
</td><td>
@ -89,7 +89,7 @@ Can be overridden by `PUPPETEER_CACHE_DIR`.
</td></tr>
<tr><td>
defaultProduct
<span id="defaultproduct">defaultProduct</span>
</td><td>
@ -112,7 +112,7 @@ Can be overridden by `PUPPETEER_PRODUCT`.
</td></tr>
<tr><td>
downloadBaseUrl
<span id="downloadbaseurl">downloadBaseUrl</span>
</td><td>
@ -135,7 +135,7 @@ Either https://storage.googleapis.com/chrome-for-testing-public or https://archi
</td></tr>
<tr><td>
executablePath
<span id="executablepath">executablePath</span>
</td><td>
@ -158,7 +158,7 @@ Can be overridden by `PUPPETEER_EXECUTABLE_PATH`.
</td></tr>
<tr><td>
experiments
<span id="experiments">experiments</span>
</td><td>
@ -177,7 +177,7 @@ Defines experimental options for Puppeteer.
</td></tr>
<tr><td>
logLevel
<span id="loglevel">logLevel</span>
</td><td>
@ -198,7 +198,7 @@ Tells Puppeteer to log at the given level.
</td></tr>
<tr><td>
skipChromeDownload
<span id="skipchromedownload">skipChromeDownload</span>
</td><td>
@ -219,7 +219,7 @@ Can be overridden by `PUPPETEER_SKIP_CHROME_DOWNLOAD`.
</td></tr>
<tr><td>
skipChromeHeadlessShellDownload
<span id="skipchromeheadlessshelldownload">skipChromeHeadlessShellDownload</span>
</td><td>
@ -240,7 +240,7 @@ Can be overridden by `PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD`.
</td></tr>
<tr><td>
skipDownload
<span id="skipdownload">skipDownload</span>
</td><td>
@ -261,7 +261,7 @@ Can be overridden by `PUPPETEER_SKIP_DOWNLOAD`.
</td></tr>
<tr><td>
temporaryDirectory
<span id="temporarydirectory">temporaryDirectory</span>
</td><td>

View File

@ -29,7 +29,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(url, transport, delay, timeout)](./puppeteer.connection._constructor_.md)
<span id="_constructor_">[(constructor)(url, transport, delay, timeout)](./puppeteer.connection._constructor_.md)</span>
</td><td>
@ -61,7 +61,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
timeout
<span id="timeout">timeout</span>
</td><td>
@ -93,7 +93,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[createSession(targetInfo)](./puppeteer.connection.createsession.md)
<span id="createsession">[createSession(targetInfo)](./puppeteer.connection.createsession.md)</span>
</td><td>
@ -102,7 +102,7 @@ Description
</td></tr>
<tr><td>
[dispose()](./puppeteer.connection.dispose.md)
<span id="dispose">[dispose()](./puppeteer.connection.dispose.md)</span>
</td><td>
@ -111,7 +111,7 @@ Description
</td></tr>
<tr><td>
[fromSession(session)](./puppeteer.connection.fromsession.md)
<span id="fromsession">[fromSession(session)](./puppeteer.connection.fromsession.md)</span>
</td><td>
@ -122,7 +122,7 @@ Description
</td></tr>
<tr><td>
[send(method, params, options)](./puppeteer.connection.send.md)
<span id="send">[send(method, params, options)](./puppeteer.connection.send.md)</span>
</td><td>
@ -131,7 +131,7 @@ Description
</td></tr>
<tr><td>
[session(sessionId)](./puppeteer.connection.session.md)
<span id="session">[session(sessionId)](./puppeteer.connection.session.md)</span>
</td><td>
@ -140,7 +140,7 @@ Description
</td></tr>
<tr><td>
[url()](./puppeteer.connection.url.md)
<span id="url">[url()](./puppeteer.connection.url.md)</span>
</td><td>

View File

@ -35,7 +35,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
onclose
<span id="onclose">onclose</span>
</td><td>
@ -52,7 +52,7 @@ onclose
</td></tr>
<tr><td>
onmessage
<span id="onmessage">onmessage</span>
</td><td>
@ -82,14 +82,14 @@ Description
</th></tr></thead>
<tbody><tr><td>
[close()](./puppeteer.connectiontransport.close.md)
<span id="close">[close()](./puppeteer.connectiontransport.close.md)</span>
</td><td>
</td></tr>
<tr><td>
[send(message)](./puppeteer.connectiontransport.send.md)
<span id="send">[send(message)](./puppeteer.connectiontransport.send.md)</span>
</td><td>

View File

@ -37,7 +37,7 @@ Default
</th></tr></thead>
<tbody><tr><td>
browserURL
<span id="browserurl">browserURL</span>
</td><td>
@ -54,7 +54,7 @@ string
</td></tr>
<tr><td>
browserWSEndpoint
<span id="browserwsendpoint">browserWSEndpoint</span>
</td><td>
@ -71,7 +71,7 @@ string
</td></tr>
<tr><td>
headers
<span id="headers">headers</span>
</td><td>
@ -90,7 +90,7 @@ Headers to use for the web socket connection.
</td></tr>
<tr><td>
transport
<span id="transport">transport</span>
</td><td>

View File

@ -29,7 +29,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(type, text, args, stackTraceLocations)](./puppeteer.consolemessage._constructor_.md)
<span id="_constructor_">[(constructor)(type, text, args, stackTraceLocations)](./puppeteer.consolemessage._constructor_.md)</span>
</td><td>
@ -57,7 +57,7 @@ Description
</th></tr></thead>
<tbody><tr><td>
[args()](./puppeteer.consolemessage.args.md)
<span id="args">[args()](./puppeteer.consolemessage.args.md)</span>
</td><td>
@ -68,7 +68,7 @@ An array of arguments passed to the console.
</td></tr>
<tr><td>
[location()](./puppeteer.consolemessage.location.md)
<span id="location">[location()](./puppeteer.consolemessage.location.md)</span>
</td><td>
@ -79,7 +79,7 @@ The location of the console message.
</td></tr>
<tr><td>
[stackTrace()](./puppeteer.consolemessage.stacktrace.md)
<span id="stacktrace">[stackTrace()](./puppeteer.consolemessage.stacktrace.md)</span>
</td><td>
@ -90,7 +90,7 @@ The array of locations on the stack of the console message.
</td></tr>
<tr><td>
[text()](./puppeteer.consolemessage.text.md)
<span id="text">[text()](./puppeteer.consolemessage.text.md)</span>
</td><td>
@ -101,7 +101,7 @@ The text of the console message.
</td></tr>
<tr><td>
[type()](./puppeteer.consolemessage.type.md)
<span id="type">[type()](./puppeteer.consolemessage.type.md)</span>
</td><td>

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