chore: release main (#11821)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This commit is contained in:
release-please[bot] 2024-02-05 10:22:00 +00:00 committed by GitHub
parent 46a3ef2681
commit 9fbb9f9653
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
606 changed files with 513 additions and 991 deletions

View File

@ -1,7 +1,7 @@
{ {
"packages/puppeteer": "21.11.0", "packages/puppeteer": "22.0.0",
"packages/puppeteer-core": "21.11.0", "packages/puppeteer-core": "22.0.0",
"packages/testserver": "0.6.0", "packages/testserver": "0.6.0",
"packages/ng-schematics": "0.5.6", "packages/ng-schematics": "0.5.6",
"packages/browsers": "1.9.1" "packages/browsers": "2.0.0"
} }

12
package-lock.json generated
View File

@ -10871,7 +10871,7 @@
}, },
"packages/browsers": { "packages/browsers": {
"name": "@puppeteer/browsers", "name": "@puppeteer/browsers",
"version": "1.9.1", "version": "2.0.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"debug": "4.3.4", "debug": "4.3.4",
@ -11367,13 +11367,13 @@
} }
}, },
"packages/puppeteer": { "packages/puppeteer": {
"version": "21.11.0", "version": "22.0.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "1.9.1", "@puppeteer/browsers": "2.0.0",
"cosmiconfig": "9.0.0", "cosmiconfig": "9.0.0",
"puppeteer-core": "21.11.0" "puppeteer-core": "22.0.0"
}, },
"bin": { "bin": {
"puppeteer": "lib/esm/puppeteer/node/cli.js" "puppeteer": "lib/esm/puppeteer/node/cli.js"
@ -11386,10 +11386,10 @@
} }
}, },
"packages/puppeteer-core": { "packages/puppeteer-core": {
"version": "21.11.0", "version": "22.0.0",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "1.9.1", "@puppeteer/browsers": "2.0.0",
"chromium-bidi": "0.5.8", "chromium-bidi": "0.5.8",
"cross-fetch": "4.0.0", "cross-fetch": "4.0.0",
"debug": "4.3.4", "debug": "4.3.4",

View File

@ -1,5 +1,16 @@
# Changelog # Changelog
## [2.0.0](https://github.com/puppeteer/puppeteer/compare/browsers-v1.9.1...browsers-v2.0.0) (2024-02-05)
### ⚠ BREAKING CHANGES
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912))
### Features
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912)) ([953f420](https://github.com/puppeteer/puppeteer/commit/953f4207b17210fa7231225e6f29a826f77e0832))
## [1.9.1](https://github.com/puppeteer/puppeteer/compare/browsers-v1.9.0...browsers-v1.9.1) (2024-01-04) ## [1.9.1](https://github.com/puppeteer/puppeteer/compare/browsers-v1.9.0...browsers-v1.9.1) (2024-01-04)

View File

@ -1,6 +1,6 @@
{ {
"name": "@puppeteer/browsers", "name": "@puppeteer/browsers",
"version": "1.9.1", "version": "2.0.0",
"description": "Download and launch browsers", "description": "Download and launch browsers",
"scripts": { "scripts": {
"build:docs": "wireit", "build:docs": "wireit",

View File

@ -20,6 +20,64 @@ All notable changes to this project will be documented in this file. See [standa
* dependencies * dependencies
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0 * @puppeteer/browsers bumped from 1.5.1 to 1.6.0
## [22.0.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v21.11.0...puppeteer-core-v22.0.0) (2024-02-05)
### ⚠ BREAKING CHANGES
* rename createIncognitoBrowserContext to createBrowserContext ([#11834](https://github.com/puppeteer/puppeteer/issues/11834))
* enable the new-headless mode by default ([#11815](https://github.com/puppeteer/puppeteer/issues/11815))
* remove networkConditions in favor of PredefinedNetworkConditions ([#11806](https://github.com/puppeteer/puppeteer/issues/11806))
* use ReadableStreams ([#11805](https://github.com/puppeteer/puppeteer/issues/11805))
* remove duplicate type names ([#11803](https://github.com/puppeteer/puppeteer/issues/11803))
* remove add/removeEventListener in favor of on/off ([#11792](https://github.com/puppeteer/puppeteer/issues/11792))
* make console warn level compatible with WebDriver BiDi ([#11790](https://github.com/puppeteer/puppeteer/issues/11790))
* remove InterceptResolutionStrategy ([#11788](https://github.com/puppeteer/puppeteer/issues/11788))
* remove devices in favor of KnownDevices ([#11787](https://github.com/puppeteer/puppeteer/issues/11787))
* remove `$x` and `waitForXpath` ([#11782](https://github.com/puppeteer/puppeteer/issues/11782))
* remove waitForTimeout ([#11780](https://github.com/puppeteer/puppeteer/issues/11780))
* generate accessible PDFs by default ([#11778](https://github.com/puppeteer/puppeteer/issues/11778))
* remove `error` const, change CustomError to PuppeteerError ([#11777](https://github.com/puppeteer/puppeteer/issues/11777))
* remove viewport resizing from ElementHandle.screenshot ([#11774](https://github.com/puppeteer/puppeteer/issues/11774))
* remove PUPPETEER_DOWNLOAD_PATH in favor of PUPPETEER_CACHE_DIR ([#11605](https://github.com/puppeteer/puppeteer/issues/11605))
* BiDi cookies ([#11532](https://github.com/puppeteer/puppeteer/issues/11532))
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912))
### Features
* BiDi cookies ([#11532](https://github.com/puppeteer/puppeteer/issues/11532)) ([9cb1fde](https://github.com/puppeteer/puppeteer/commit/9cb1fde58949811532644decb79b691318031d8c))
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912)) ([953f420](https://github.com/puppeteer/puppeteer/commit/953f4207b17210fa7231225e6f29a826f77e0832))
* generate accessible PDFs by default ([#11778](https://github.com/puppeteer/puppeteer/issues/11778)) ([4fc1402](https://github.com/puppeteer/puppeteer/commit/4fc14026e9bfffeedf317e9b61c7cda8509091ba))
* remove PUPPETEER_DOWNLOAD_PATH in favor of PUPPETEER_CACHE_DIR ([#11605](https://github.com/puppeteer/puppeteer/issues/11605)) ([4677281](https://github.com/puppeteer/puppeteer/commit/467728187737283191f6528676e50d53dae6e5ef))
### Bug Fixes
* make console warn level compatible with WebDriver BiDi ([#11790](https://github.com/puppeteer/puppeteer/issues/11790)) ([d4e9d8d](https://github.com/puppeteer/puppeteer/commit/d4e9d8d591e4fb1e2a33fe3a586a8beaccf263e8))
* remove viewport resizing from ElementHandle.screenshot ([#11774](https://github.com/puppeteer/puppeteer/issues/11774)) ([ced2235](https://github.com/puppeteer/puppeteer/commit/ced2235ada95ad67227df0ce579070ccb501a47b))
### Code Refactoring
* enable the new-headless mode by default ([#11815](https://github.com/puppeteer/puppeteer/issues/11815)) ([75c9e11](https://github.com/puppeteer/puppeteer/commit/75c9e117f1bf0d7a4de82c79201d70bf3cee2b6f))
* remove `$x` and `waitForXpath` ([#11782](https://github.com/puppeteer/puppeteer/issues/11782)) ([53c9134](https://github.com/puppeteer/puppeteer/commit/53c91348094dc0bce59086c98986c5d06a949d08))
* remove `error` const, change CustomError to PuppeteerError ([#11777](https://github.com/puppeteer/puppeteer/issues/11777)) ([b3bfdd2](https://github.com/puppeteer/puppeteer/commit/b3bfdd2024097be1974e28b3766419189b4a9fe0))
* remove add/removeEventListener in favor of on/off ([#11792](https://github.com/puppeteer/puppeteer/issues/11792)) ([f160874](https://github.com/puppeteer/puppeteer/commit/f1608743c83e8ce7b56aec98ccdddacc91b86179))
* remove devices in favor of KnownDevices ([#11787](https://github.com/puppeteer/puppeteer/issues/11787)) ([eb360e3](https://github.com/puppeteer/puppeteer/commit/eb360e3a762d9232a4972d4ec877b7d57a5b60c7))
* remove duplicate type names ([#11803](https://github.com/puppeteer/puppeteer/issues/11803)) ([514e2d5](https://github.com/puppeteer/puppeteer/commit/514e2d5241dc3a9027c96d739cfc99efc5a02783))
* remove InterceptResolutionStrategy ([#11788](https://github.com/puppeteer/puppeteer/issues/11788)) ([f18d447](https://github.com/puppeteer/puppeteer/commit/f18d44761cd1acc2e6b867e5eb2ebd753854e9ea))
* remove networkConditions in favor of PredefinedNetworkConditions ([#11806](https://github.com/puppeteer/puppeteer/issues/11806)) ([7564dfa](https://github.com/puppeteer/puppeteer/commit/7564dfa9110e44b1f50f5fb1543c5c7d8529c182))
* remove waitForTimeout ([#11780](https://github.com/puppeteer/puppeteer/issues/11780)) ([1900fa9](https://github.com/puppeteer/puppeteer/commit/1900fa94183e0a8654633a91f82b372ad068da71))
* rename createIncognitoBrowserContext to createBrowserContext ([#11834](https://github.com/puppeteer/puppeteer/issues/11834)) ([46a3ef2](https://github.com/puppeteer/puppeteer/commit/46a3ef2681456d604e775f578fa447a094200610))
* use ReadableStreams ([#11805](https://github.com/puppeteer/puppeteer/issues/11805)) ([84d9a94](https://github.com/puppeteer/puppeteer/commit/84d9a94d6228800e9f80914472ff2e5a4ee71b18))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @puppeteer/browsers bumped from 1.9.1 to 2.0.0
## [21.11.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v21.10.0...puppeteer-core-v21.11.0) (2024-02-02) ## [21.11.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v21.10.0...puppeteer-core-v21.11.0) (2024-02-02)

View File

@ -1,6 +1,6 @@
{ {
"name": "puppeteer-core", "name": "puppeteer-core",
"version": "21.11.0", "version": "22.0.0",
"description": "A high-level API to control headless Chrome over the DevTools Protocol", "description": "A high-level API to control headless Chrome over the DevTools Protocol",
"keywords": [ "keywords": [
"puppeteer", "puppeteer",
@ -118,7 +118,7 @@
"author": "The Chromium Authors", "author": "The Chromium Authors",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "1.9.1", "@puppeteer/browsers": "2.0.0",
"chromium-bidi": "0.5.8", "chromium-bidi": "0.5.8",
"cross-fetch": "4.0.0", "cross-fetch": "4.0.0",
"debug": "4.3.4", "debug": "4.3.4",

View File

@ -29,6 +29,27 @@ 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-core bumped from 21.0.2 to 21.0.3
* @puppeteer/browsers bumped from 1.5.1 to 1.6.0 * @puppeteer/browsers bumped from 1.5.1 to 1.6.0
## [22.0.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-v21.11.0...puppeteer-v22.0.0) (2024-02-05)
### ⚠ BREAKING CHANGES
* remove PUPPETEER_DOWNLOAD_PATH in favor of PUPPETEER_CACHE_DIR ([#11605](https://github.com/puppeteer/puppeteer/issues/11605))
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912))
### Features
* drop support for node16 ([#10912](https://github.com/puppeteer/puppeteer/issues/10912)) ([953f420](https://github.com/puppeteer/puppeteer/commit/953f4207b17210fa7231225e6f29a826f77e0832))
* remove PUPPETEER_DOWNLOAD_PATH in favor of PUPPETEER_CACHE_DIR ([#11605](https://github.com/puppeteer/puppeteer/issues/11605)) ([4677281](https://github.com/puppeteer/puppeteer/commit/467728187737283191f6528676e50d53dae6e5ef))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* puppeteer-core bumped from 21.11.0 to 22.0.0
* @puppeteer/browsers bumped from 1.9.1 to 2.0.0
## [21.11.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-v21.10.0...puppeteer-v21.11.0) (2024-02-02) ## [21.11.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-v21.10.0...puppeteer-v21.11.0) (2024-02-02)

View File

@ -1,6 +1,6 @@
{ {
"name": "puppeteer", "name": "puppeteer",
"version": "21.11.0", "version": "22.0.0",
"description": "A high-level API to control headless Chrome over the DevTools Protocol", "description": "A high-level API to control headless Chrome over the DevTools Protocol",
"keywords": [ "keywords": [
"puppeteer", "puppeteer",
@ -124,8 +124,8 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"cosmiconfig": "9.0.0", "cosmiconfig": "9.0.0",
"puppeteer-core": "21.11.0", "puppeteer-core": "22.0.0",
"@puppeteer/browsers": "1.9.1" "@puppeteer/browsers": "2.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "18.17.15" "@types/node": "18.17.15"

View File

@ -1,23 +0,0 @@
---
sidebar_label: BrowserLaunchArgumentOptions
---
# BrowserLaunchArgumentOptions interface
Launcher options that only apply to Chrome.
#### Signature:
```typescript
export interface BrowserLaunchArgumentOptions
```
## Properties
| Property | Modifiers | Type | Description | Default |
| ------------- | --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| args | <code>optional</code> | string\[\] | Additional command line arguments to pass to the browser instance. | |
| debuggingPort | <code>optional</code> | number | Specify the debugging port number to use | |
| devtools | <code>optional</code> | boolean | Whether to auto-open a DevTools panel for each tab. If this is set to <code>true</code>, then <code>headless</code> will be forced to <code>false</code>. | <code>false</code> |
| headless | <code>optional</code> | boolean \| 'new' | Whether to run the browser in headless mode. | <code>true</code> |
| userDataDir | <code>optional</code> | string | Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | |

View File

@ -1,27 +0,0 @@
---
sidebar_label: CommonEventEmitter.addListener
---
# CommonEventEmitter.addListener() method
#### Signature:
```typescript
interface CommonEventEmitter {
addListener<Key extends keyof Events>(
type: Key,
handler: Handler<Events[Key]>
): this;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | ------------------------------------------------------ | ----------- |
| type | Key | |
| handler | [Handler](./puppeteer.handler.md)&lt;Events\[Key\]&gt; | |
**Returns:**
this

View File

@ -1,27 +0,0 @@
---
sidebar_label: CommonEventEmitter.removeListener
---
# CommonEventEmitter.removeListener() method
#### Signature:
```typescript
interface CommonEventEmitter {
removeListener<Key extends keyof Events>(
type: Key,
handler: Handler<Events[Key]>
): this;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | ------------------------------------------------------ | ----------- |
| type | Key | |
| handler | [Handler](./puppeteer.handler.md)&lt;Events\[Key\]&gt; | |
**Returns:**
this

View File

@ -1,134 +0,0 @@
---
sidebar_label: devices
---
# devices variable
> Warning: This API is now obsolete.
>
> Import [KnownDevices](./puppeteer.knowndevices.md)
#### Signature:
```typescript
devices: Readonly<
Record<
| 'Blackberry PlayBook'
| 'Blackberry PlayBook landscape'
| 'BlackBerry Z30'
| 'BlackBerry Z30 landscape'
| 'Galaxy Note 3'
| 'Galaxy Note 3 landscape'
| 'Galaxy Note II'
| 'Galaxy Note II landscape'
| 'Galaxy S III'
| 'Galaxy S III landscape'
| 'Galaxy S5'
| 'Galaxy S5 landscape'
| 'Galaxy S8'
| 'Galaxy S8 landscape'
| 'Galaxy S9+'
| 'Galaxy S9+ landscape'
| 'Galaxy Tab S4'
| 'Galaxy Tab S4 landscape'
| 'iPad'
| 'iPad landscape'
| 'iPad (gen 6)'
| 'iPad (gen 6) landscape'
| 'iPad (gen 7)'
| 'iPad (gen 7) landscape'
| 'iPad Mini'
| 'iPad Mini landscape'
| 'iPad Pro'
| 'iPad Pro landscape'
| 'iPad Pro 11'
| 'iPad Pro 11 landscape'
| 'iPhone 4'
| 'iPhone 4 landscape'
| 'iPhone 5'
| 'iPhone 5 landscape'
| 'iPhone 6'
| 'iPhone 6 landscape'
| 'iPhone 6 Plus'
| 'iPhone 6 Plus landscape'
| 'iPhone 7'
| 'iPhone 7 landscape'
| 'iPhone 7 Plus'
| 'iPhone 7 Plus landscape'
| 'iPhone 8'
| 'iPhone 8 landscape'
| 'iPhone 8 Plus'
| 'iPhone 8 Plus landscape'
| 'iPhone SE'
| 'iPhone SE landscape'
| 'iPhone X'
| 'iPhone X landscape'
| 'iPhone XR'
| 'iPhone XR landscape'
| 'iPhone 11'
| 'iPhone 11 landscape'
| 'iPhone 11 Pro'
| 'iPhone 11 Pro landscape'
| 'iPhone 11 Pro Max'
| 'iPhone 11 Pro Max landscape'
| 'iPhone 12'
| 'iPhone 12 landscape'
| 'iPhone 12 Pro'
| 'iPhone 12 Pro landscape'
| 'iPhone 12 Pro Max'
| 'iPhone 12 Pro Max landscape'
| 'iPhone 12 Mini'
| 'iPhone 12 Mini landscape'
| 'iPhone 13'
| 'iPhone 13 landscape'
| 'iPhone 13 Pro'
| 'iPhone 13 Pro landscape'
| 'iPhone 13 Pro Max'
| 'iPhone 13 Pro Max landscape'
| 'iPhone 13 Mini'
| 'iPhone 13 Mini landscape'
| 'JioPhone 2'
| 'JioPhone 2 landscape'
| 'Kindle Fire HDX'
| 'Kindle Fire HDX landscape'
| 'LG Optimus L70'
| 'LG Optimus L70 landscape'
| 'Microsoft Lumia 550'
| 'Microsoft Lumia 950'
| 'Microsoft Lumia 950 landscape'
| 'Nexus 10'
| 'Nexus 10 landscape'
| 'Nexus 4'
| 'Nexus 4 landscape'
| 'Nexus 5'
| 'Nexus 5 landscape'
| 'Nexus 5X'
| 'Nexus 5X landscape'
| 'Nexus 6'
| 'Nexus 6 landscape'
| 'Nexus 6P'
| 'Nexus 6P landscape'
| 'Nexus 7'
| 'Nexus 7 landscape'
| 'Nokia Lumia 520'
| 'Nokia Lumia 520 landscape'
| 'Nokia N9'
| 'Nokia N9 landscape'
| 'Pixel 2'
| 'Pixel 2 landscape'
| 'Pixel 2 XL'
| 'Pixel 2 XL landscape'
| 'Pixel 3'
| 'Pixel 3 landscape'
| 'Pixel 4'
| 'Pixel 4 landscape'
| 'Pixel 4a (5G)'
| 'Pixel 4a (5G) landscape'
| 'Pixel 5'
| 'Pixel 5 landscape'
| 'Moto G4'
| 'Moto G4 landscape',
Device
>
>;
```

View File

@ -1,33 +0,0 @@
---
sidebar_label: ElementHandle.$x
---
# ElementHandle.$x() method
> Warning: This API is now obsolete.
>
> Use [ElementHandle.$$()](./puppeteer.elementhandle.__.md) with the `xpath` prefix.
>
> Example: `await elementHandle.$$('xpath/' + xpathExpression)`
>
> The method evaluates the XPath expression relative to the elementHandle. If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically.
>
> If there are no such elements, the method will resolve to an empty array.
#### Signature:
```typescript
class ElementHandle {
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
}
```
## Parameters
| Parameter | Type | Description |
| ---------- | ------ | -------------------------------------------------------------------------------------------- |
| expression | string | Expression to [evaluate](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) |
**Returns:**
Promise&lt;Array&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt;&gt;&gt;

View File

@ -1,79 +0,0 @@
---
sidebar_label: ElementHandle.waitForXPath
---
# ElementHandle.waitForXPath() method
> Warning: This API is now obsolete.
>
> Use [ElementHandle.waitForSelector()](./puppeteer.elementhandle.waitforselector.md) with the `xpath` prefix.
>
> Example: `await elementHandle.waitForSelector('xpath/' + xpathExpression)`
>
> The method evaluates the XPath expression relative to the elementHandle.
>
> Wait for the `xpath` within the element. If at the moment of calling the method the `xpath` already exists, the method will return immediately. If the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the function will throw.
>
> If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically.
#### Signature:
```typescript
class ElementHandle {
waitForXPath(
xpath: string,
options?: {
visible?: boolean;
hidden?: boolean;
timeout?: number;
}
): Promise<ElementHandle<Node> | null>;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| xpath | string | A [xpath](https://developer.mozilla.org/en-US/docs/Web/XPath) of an element to wait for |
| options | &#123; visible?: boolean; hidden?: boolean; timeout?: number; &#125; | _(Optional)_ Optional waiting parameters |
**Returns:**
Promise&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt; \| null&gt;
Promise which resolves when element specified by xpath string is added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is not found in DOM, otherwise resolves to `ElementHandle`.
## Remarks
The optional Argument `options` have properties:
- `visible`: A boolean to wait for element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `hidden`: A boolean wait for element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `timeout`: A number which is maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.
## Example
This method works across navigation.
```ts
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
let currentURL;
page
.waitForXPath('//img')
.then(() => console.log('First URL with image: ' + currentURL));
for (currentURL of [
'https://example.com',
'https://google.com',
'https://bbc.com',
]) {
await page.goto(currentURL);
}
await browser.close();
})();
```

View File

@ -1,33 +0,0 @@
---
sidebar_label: errors
---
# errors variable
> Warning: This API is now obsolete.
>
> Import error classes directly.
>
> Puppeteer methods might throw errors if they are unable to fulfill a request. For example, `page.waitForSelector(selector[, options])` might fail if the selector doesn't match any nodes during the given timeframe.
>
> For certain types of errors Puppeteer uses specific error classes. These classes are available via `puppeteer.errors`.
#### Signature:
```typescript
errors: PuppeteerErrors;
```
## Example
An example of handling a timeout error:
```ts
try {
await page.waitForSelector('.foo');
} catch (e) {
if (e instanceof TimeoutError) {
// Do something if this is a timeout.
}
}
```

View File

@ -1,33 +0,0 @@
---
sidebar_label: EventEmitter.addListener
---
# EventEmitter.addListener() method
> Warning: This API is now obsolete.
>
> please use [EventEmitter.on()](./puppeteer.eventemitter.on.md) instead.
Add an event listener.
#### Signature:
```typescript
class EventEmitter {
addListener<Key extends keyof EventsWithWildcard<Events>>(
type: Key,
handler: Handler<EventsWithWildcard<Events>[Key]>
): this;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | --------------------------------------------------------------------------------------------------------------------- | ----------- |
| type | Key | |
| handler | [Handler](./puppeteer.handler.md)&lt;[EventsWithWildcard](./puppeteer.eventswithwildcard.md)&lt;Events&gt;\[Key\]&gt; | |
**Returns:**
this

View File

@ -1,34 +0,0 @@
---
sidebar_label: EventEmitter
---
# EventEmitter class
The EventEmitter class that many Puppeteer classes extend.
#### Signature:
```typescript
export declare class EventEmitter<Events extends Record<EventType, unknown>> implements CommonEventEmitter<EventsWithWildcard<Events>>
```
**Implements:** [CommonEventEmitter](./puppeteer.commoneventemitter.md)&lt;[EventsWithWildcard](./puppeteer.eventswithwildcard.md)&lt;Events&gt;&gt;
## Remarks
This allows you to listen to events that Puppeteer classes fire and act accordingly. Therefore you'll mostly use [on](./puppeteer.eventemitter.on.md) and [off](./puppeteer.eventemitter.off.md) to bind and unbind to event listeners.
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `EventEmitter` class.
## Methods
| Method | Modifiers | Description |
| --------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------ |
| [addListener(type, handler)](./puppeteer.eventemitter.addlistener.md) | | Add an event listener. |
| [emit(type, event)](./puppeteer.eventemitter.emit.md) | | Emit an event and call any associated listeners. |
| [listenerCount(type)](./puppeteer.eventemitter.listenercount.md) | | Gets the number of listeners for a given event. |
| [off(type, handler)](./puppeteer.eventemitter.off.md) | | Remove an event listener from firing. |
| [on(type, handler)](./puppeteer.eventemitter.on.md) | | Bind an event listener to fire when an event occurs. |
| [once(type, handler)](./puppeteer.eventemitter.once.md) | | Like <code>on</code> but the listener will only be fired once and then it will be removed. |
| [removeAllListeners(type)](./puppeteer.eventemitter.removealllisteners.md) | | Removes all listeners. If given an event argument, it will remove only listeners for that event. |
| [removeListener(type, handler)](./puppeteer.eventemitter.removelistener.md) | | Remove an event listener. |

View File

@ -1,33 +0,0 @@
---
sidebar_label: EventEmitter.removeListener
---
# EventEmitter.removeListener() method
> Warning: This API is now obsolete.
>
> please use [EventEmitter.off()](./puppeteer.eventemitter.off.md) instead.
Remove an event listener.
#### Signature:
```typescript
class EventEmitter {
removeListener<Key extends keyof EventsWithWildcard<Events>>(
type: Key,
handler: Handler<EventsWithWildcard<Events>[Key]>
): this;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | --------------------------------------------------------------------------------------------------------------------- | ----------- |
| type | Key | |
| handler | [Handler](./puppeteer.handler.md)&lt;[EventsWithWildcard](./puppeteer.eventswithwildcard.md)&lt;Events&gt;\[Key\]&gt; | |
**Returns:**
this

View File

@ -1,31 +0,0 @@
---
sidebar_label: Frame.$x
---
# Frame.$x() method
> Warning: This API is now obsolete.
>
> Use [Frame.$$()](./puppeteer.frame.__.md) with the `xpath` prefix.
>
> Example: `await frame.$$('xpath/' + xpathExpression)`
>
> This method evaluates the given XPath expression and returns the results. If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically.
#### Signature:
```typescript
class Frame {
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
}
```
## Parameters
| Parameter | Type | Description |
| ---------- | ------ | --------------------------------- |
| expression | string | the XPath expression to evaluate. |
**Returns:**
Promise&lt;Array&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt;&gt;&gt;

View File

@ -1,41 +0,0 @@
---
sidebar_label: Frame.waitForTimeout
---
# Frame.waitForTimeout() method
> Warning: This API is now obsolete.
>
> Replace with `new Promise(r => setTimeout(r, milliseconds));`.
>
> Causes your script to wait for the given number of milliseconds.
#### Signature:
```typescript
class Frame {
waitForTimeout(milliseconds: number): Promise<void>;
}
```
## Parameters
| Parameter | Type | Description |
| ------------ | ------ | ----------------------------------- |
| milliseconds | number | the number of milliseconds to wait. |
**Returns:**
Promise&lt;void&gt;
## Remarks
It's generally recommended to not wait for a number of seconds, but instead use [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), or [Frame.waitForFunction()](./puppeteer.frame.waitforfunction.md) to wait for exactly the conditions you want.
## Example
Wait for 1 second:
```ts
await frame.waitForTimeout(1000);
```

View File

@ -1,39 +0,0 @@
---
sidebar_label: Frame.waitForXPath
---
# Frame.waitForXPath() method
> Warning: This API is now obsolete.
>
> Use [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md) with the `xpath` prefix.
>
> Example: `await frame.waitForSelector('xpath/' + xpathExpression)`
>
> The method evaluates the XPath expression relative to the Frame. If `xpath` starts with `//` instead of `.//`, the dot will be appended automatically.
>
> Wait for the `xpath` to appear in page. If at the moment of calling the method the `xpath` already exists, the method will return immediately. If the xpath doesn't appear after the `timeout` milliseconds of waiting, the function will throw.
>
> For a code example, see the example for [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md). That function behaves identically other than taking a CSS selector rather than an XPath.
#### Signature:
```typescript
class Frame {
waitForXPath(
xpath: string,
options?: WaitForSelectorOptions
): Promise<ElementHandle<Node> | null>;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| xpath | string | the XPath expression to wait for. |
| options | [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | _(Optional)_ options to configure the visibility of the element and how long to wait before timing out. |
**Returns:**
Promise&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt; \| null&gt;

View File

@ -1,17 +0,0 @@
---
sidebar_label: InterceptResolutionStrategy
---
# InterceptResolutionStrategy type
> Warning: This API is now obsolete.
>
> please use [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md) instead.
#### Signature:
```typescript
export type InterceptResolutionStrategy = InterceptResolutionAction;
```
**References:** [InterceptResolutionAction](./puppeteer.interceptresolutionaction.md)

View File

@ -1,18 +0,0 @@
---
sidebar_label: networkConditions
---
# networkConditions variable
> Warning: This API is now obsolete.
>
> Import [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md).
#### Signature:
```typescript
networkConditions: Readonly<{
'Slow 3G': NetworkConditions;
'Fast 3G': NetworkConditions;
}>;
```

View File

@ -1,29 +0,0 @@
---
sidebar_label: Page.$x
---
# Page.$x() method
The method evaluates the XPath expression relative to the page document as its context node. If there are no such elements, the method resolves to an empty array.
#### Signature:
```typescript
class Page {
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
}
```
## Parameters
| Parameter | Type | Description |
| ---------- | ------ | ---------------------- |
| expression | string | Expression to evaluate |
**Returns:**
Promise&lt;Array&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt;&gt;&gt;
## Remarks
Shortcut for [Page.mainFrame().$x(expression)](./puppeteer.frame._x.md).

View File

@ -1,25 +0,0 @@
---
sidebar_label: Page.deleteCookie
---
# Page.deleteCookie() method
#### Signature:
```typescript
class Page {
abstract deleteCookie(
...cookies: Protocol.Network.DeleteCookiesRequest[]
): Promise<void>;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | ----------------------------------------- | ----------- |
| cookies | Protocol.Network.DeleteCookiesRequest\[\] | |
**Returns:**
Promise&lt;void&gt;

View File

@ -1,29 +0,0 @@
---
sidebar_label: Page.setCookie
---
# Page.setCookie() method
#### Signature:
```typescript
class Page {
abstract setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | -------------------------------- | ----------- |
| cookies | Protocol.Network.CookieParam\[\] | |
**Returns:**
Promise&lt;void&gt;
## Example
```ts
await page.setCookie(cookieObject1, cookieObject2);
```

View File

@ -1,41 +0,0 @@
---
sidebar_label: Page.waitForTimeout
---
# Page.waitForTimeout() method
> Warning: This API is now obsolete.
>
> Replace with `new Promise(r => setTimeout(r, milliseconds));`.
>
> Causes your script to wait for the given number of milliseconds.
#### Signature:
```typescript
class Page {
waitForTimeout(milliseconds: number): Promise<void>;
}
```
## Parameters
| Parameter | Type | Description |
| ------------ | ------ | ----------------------------------- |
| milliseconds | number | the number of milliseconds to wait. |
**Returns:**
Promise&lt;void&gt;
## Remarks
It's generally recommended to not wait for a number of seconds, but instead use [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), or [Frame.waitForFunction()](./puppeteer.frame.waitforfunction.md) to wait for exactly the conditions you want.
## Example
Wait for 1 second:
```ts
await page.waitForTimeout(1000);
```

View File

@ -1,65 +0,0 @@
---
sidebar_label: Page.waitForXPath
---
# Page.waitForXPath() method
Wait for the `xpath` to appear in page. If at the moment of calling the method the `xpath` already exists, the method will return immediately. If the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the function will throw.
#### Signature:
```typescript
class Page {
waitForXPath(
xpath: string,
options?: WaitForSelectorOptions
): Promise<ElementHandle<Node> | null>;
}
```
## Parameters
| Parameter | Type | Description |
| --------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| xpath | string | A [xpath](https://developer.mozilla.org/en-US/docs/Web/XPath) of an element to wait for |
| options | [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | _(Optional)_ Optional waiting parameters |
**Returns:**
Promise&lt;[ElementHandle](./puppeteer.elementhandle.md)&lt;Node&gt; \| null&gt;
Promise which resolves when element specified by xpath string is added to DOM. Resolves to `null` if waiting for `hidden: true` and xpath is not found in DOM, otherwise resolves to `ElementHandle`.
## Remarks
The optional Argument `options` have properties:
- `visible`: A boolean to wait for element to be present in DOM and to be visible, i.e. to not have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `hidden`: A boolean wait for element to not be found in the DOM or to be hidden, i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to `false`.
- `timeout`: A number which is maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.
## Example
This method works across navigation
```ts
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
let currentURL;
page
.waitForXPath('//img')
.then(() => console.log('First URL with image: ' + currentURL));
for (currentURL of [
'https://example.com',
'https://google.com',
'https://bbc.com',
]) {
await page.goto(currentURL);
}
await browser.close();
})();
```

View File

@ -1,22 +0,0 @@
---
sidebar_label: PuppeteerErrors
---
# PuppeteerErrors interface
> Warning: This API is now obsolete.
>
> Do not use.
#### Signature:
```typescript
export interface PuppeteerErrors
```
## Properties
| Property | Modifiers | Type | Description | Default |
| ------------- | --------- | ---------------------------------------------------- | ----------- | ------- |
| ProtocolError | | typeof [ProtocolError](./puppeteer.protocolerror.md) | | |
| TimeoutError | | typeof [TimeoutError](./puppeteer.timeouterror.md) | | |

View File

@ -7,16 +7,15 @@ sidebar_label: API
## Classes ## Classes
| Class | Description | | Class | Description |
| --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting the browser'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). | | [Accessibility](./puppeteer.accessibility.md) | The Accessibility class provides methods for inspecting the browser's accessibility tree. The accessibility tree is used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or [switches](https://en.wikipedia.org/wiki/Switch_access). |
| [Browser](./puppeteer.browser.md) | <p>[Browser](./puppeteer.browser.md) represents a browser instance that is either:</p><p>- connected to via [Puppeteer.connect()](./puppeteer.puppeteer.connect.md) or - launched by [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md).</p><p>[Browser](./puppeteer.browser.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserEvent](./puppeteer.browserevent.md) enum.</p> | | [Browser](./puppeteer.browser.md) | <p>[Browser](./puppeteer.browser.md) represents a browser instance that is either:</p><p>- connected to via [Puppeteer.connect()](./puppeteer.puppeteer.connect.md) or - launched by [PuppeteerNode.launch()](./puppeteer.puppeteernode.launch.md).</p><p>[Browser](./puppeteer.browser.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserEvent](./puppeteer.browserevent.md) enum.</p> |
| [BrowserContext](./puppeteer.browsercontext.md) | <p>[BrowserContext](./puppeteer.browsercontext.md) represents individual sessions within a [browser](./puppeteer.browser.md).</p><p>When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createIncognitoBrowserContext()](./puppeteer.browser.createincognitobrowsercontext.md).</p><p>[BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum.</p><p>If a [page](./puppeteer.page.md) opens another [page](./puppeteer.page.md), e.g. using <code>window.open</code>, the popup will belong to the parent [page's browser context](./puppeteer.page.browsercontext.md).</p> | | [BrowserContext](./puppeteer.browsercontext.md) | <p>[BrowserContext](./puppeteer.browsercontext.md) represents individual user contexts within a [browser](./puppeteer.browser.md).</p><p>When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createBrowserContext()](./puppeteer.browser.createbrowsercontext.md). Each context has isolated storage (cookies/localStorage/etc.)</p><p>[BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum.</p><p>If a [page](./puppeteer.page.md) opens another [page](./puppeteer.page.md), e.g. using <code>window.open</code>, the popup will belong to the parent [page's browser context](./puppeteer.page.browsercontext.md).</p> |
| [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. | | [CDPSession](./puppeteer.cdpsession.md) | The <code>CDPSession</code> instances are used to talk raw Chrome Devtools Protocol. |
| [Connection](./puppeteer.connection.md) | | | [Connection](./puppeteer.connection.md) | |
| [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. | | [ConsoleMessage](./puppeteer.consolemessage.md) | ConsoleMessage objects are dispatched by page via the 'console' event. |
| [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page. | | [Coverage](./puppeteer.coverage.md) | The Coverage class provides methods to gather information about parts of JavaScript and CSS that were used by the page. |
| [CSSCoverage](./puppeteer.csscoverage.md) | | | [CSSCoverage](./puppeteer.csscoverage.md) | |
| [CustomError](./puppeteer.customerror.md) | |
| [DeviceRequestPrompt](./puppeteer.devicerequestprompt.md) | Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth. | | [DeviceRequestPrompt](./puppeteer.devicerequestprompt.md) | Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth. |
| [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md) | Device in a request prompt. | | [DeviceRequestPromptDevice](./puppeteer.devicerequestpromptdevice.md) | Device in a request prompt. |
| [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. | | [Dialog](./puppeteer.dialog.md) | Dialog instances are dispatched by the [Page](./puppeteer.page.md) via the <code>dialog</code> event. |
@ -35,6 +34,7 @@ sidebar_label: API
| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. | | [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. |
| [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. | | [ProtocolError](./puppeteer.protocolerror.md) | ProtocolError is emitted whenever there is an error from the protocol. |
| [Puppeteer](./puppeteer.puppeteer.md) | <p>The main Puppeteer class.</p><p>IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require <code>puppeteer</code>. That class extends <code>Puppeteer</code>, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).</p> | | [Puppeteer](./puppeteer.puppeteer.md) | <p>The main Puppeteer class.</p><p>IMPORTANT: if you are using Puppeteer in a Node environment, you will get an instance of [PuppeteerNode](./puppeteer.puppeteernode.md) when you import or require <code>puppeteer</code>. That class extends <code>Puppeteer</code>, so has all the methods documented below as well as all that are defined on [PuppeteerNode](./puppeteer.puppeteernode.md).</p> |
| [PuppeteerError](./puppeteer.puppeteererror.md) | The base class for all Puppeteer-specific errors |
| [PuppeteerNode](./puppeteer.puppeteernode.md) | <p>Extends the main [Puppeteer](./puppeteer.puppeteer.md) class with Node specific behaviour for fetching and downloading browsers.</p><p>If you're using Puppeteer in a Node environment, this is the class you'll get when you run <code>require('puppeteer')</code> (or the equivalent ES <code>import</code>).</p> | | [PuppeteerNode](./puppeteer.puppeteernode.md) | <p>Extends the main [Puppeteer](./puppeteer.puppeteer.md) class with Node specific behaviour for fetching and downloading browsers.</p><p>If you're using Puppeteer in a Node environment, this is the class you'll get when you run <code>require('puppeteer')</code> (or the equivalent ES <code>import</code>).</p> |
| [ScreenRecorder](./puppeteer.screenrecorder.md) | | | [ScreenRecorder](./puppeteer.screenrecorder.md) | |
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. | | [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
@ -87,11 +87,14 @@ sidebar_label: API
| [ConnectOptions](./puppeteer.connectoptions.md) | | | [ConnectOptions](./puppeteer.connectoptions.md) | |
| [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | | | [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | |
| [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | | | [ContinueRequestOverrides](./puppeteer.continuerequestoverrides.md) | |
| [Cookie](./puppeteer.cookie.md) | Represents a cookie object. |
| [CookieParam](./puppeteer.cookieparam.md) | Cookie parameter object |
| [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. | | [CoverageEntry](./puppeteer.coverageentry.md) | The CoverageEntry class represents one entry of the coverage report. |
| [Credentials](./puppeteer.credentials.md) | | | [Credentials](./puppeteer.credentials.md) | |
| [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. | | [CSSCoverageOptions](./puppeteer.csscoverageoptions.md) | Set of configurable options for CSS coverage. |
| [CustomQueryHandler](./puppeteer.customqueryhandler.md) | | | [CustomQueryHandler](./puppeteer.customqueryhandler.md) | |
| [DebugInfo](./puppeteer.debuginfo.md) | | | [DebugInfo](./puppeteer.debuginfo.md) | |
| [DeleteCookiesRequest](./puppeteer.deletecookiesrequest.md) | |
| [Device](./puppeteer.device.md) | | | [Device](./puppeteer.device.md) | |
| [ElementScreenshotOptions](./puppeteer.elementscreenshotoptions.md) | | | [ElementScreenshotOptions](./puppeteer.elementscreenshotoptions.md) | |
| [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | | | [FrameAddScriptTagOptions](./puppeteer.frameaddscripttagoptions.md) | |
@ -124,7 +127,6 @@ sidebar_label: API
| [PDFMargin](./puppeteer.pdfmargin.md) | | | [PDFMargin](./puppeteer.pdfmargin.md) | |
| [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). | | [PDFOptions](./puppeteer.pdfoptions.md) | Valid options to configure PDF generation via [Page.pdf()](./puppeteer.page.pdf.md). |
| [Point](./puppeteer.point.md) | | | [Point](./puppeteer.point.md) | |
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | | | [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | |
| [RemoteAddress](./puppeteer.remoteaddress.md) | | | [RemoteAddress](./puppeteer.remoteaddress.md) | |
| [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. | | [ResponseForRequest](./puppeteer.responseforrequest.md) | Required response data to fulfill a request with. |
@ -154,13 +156,10 @@ sidebar_label: API
| [connect](./puppeteer.connect.md) | | | [connect](./puppeteer.connect.md) | |
| [DEFAULT_INTERCEPT_RESOLUTION_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority | | [DEFAULT_INTERCEPT_RESOLUTION_PRIORITY](./puppeteer.default_intercept_resolution_priority.md) | The default cooperative request interception resolution priority |
| [defaultArgs](./puppeteer.defaultargs.md) | | | [defaultArgs](./puppeteer.defaultargs.md) | |
| [devices](./puppeteer.devices.md) | |
| [errors](./puppeteer.errors.md) | |
| [executablePath](./puppeteer.executablepath.md) | | | [executablePath](./puppeteer.executablepath.md) | |
| [KnownDevices](./puppeteer.knowndevices.md) | A list of devices to be used with [Page.emulate()](./puppeteer.page.emulate.md). | | [KnownDevices](./puppeteer.knowndevices.md) | A list of devices to be used with [Page.emulate()](./puppeteer.page.emulate.md). |
| [launch](./puppeteer.launch.md) | | | [launch](./puppeteer.launch.md) | |
| [MouseButton](./puppeteer.mousebutton.md) | Enum of valid mouse buttons. | | [MouseButton](./puppeteer.mousebutton.md) | Enum of valid mouse buttons. |
| [networkConditions](./puppeteer.networkconditions.md) | |
| [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md) | A list of network conditions to be used with [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md). | | [PredefinedNetworkConditions](./puppeteer.predefinednetworkconditions.md) | A list of network conditions to be used with [Page.emulateNetworkConditions()](./puppeteer.page.emulatenetworkconditions.md). |
| [puppeteer](./puppeteer.puppeteer.md) | | | [puppeteer](./puppeteer.puppeteer.md) | |
| [trimCache](./puppeteer.trimcache.md) | | | [trimCache](./puppeteer.trimcache.md) | |
@ -168,7 +167,7 @@ sidebar_label: API
## Type Aliases ## Type Aliases
| Type Alias | Description | | Type Alias | Description |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ActionResult](./puppeteer.actionresult.md) | | | [ActionResult](./puppeteer.actionresult.md) | |
| [Awaitable](./puppeteer.awaitable.md) | | | [Awaitable](./puppeteer.awaitable.md) | |
| [AwaitableIterable](./puppeteer.awaitableiterable.md) | | | [AwaitableIterable](./puppeteer.awaitableiterable.md) | |
@ -177,6 +176,9 @@ sidebar_label: API
| [CDPEvents](./puppeteer.cdpevents.md) | | | [CDPEvents](./puppeteer.cdpevents.md) | |
| [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | | | [ChromeReleaseChannel](./puppeteer.chromereleasechannel.md) | |
| [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. | | [ConsoleMessageType](./puppeteer.consolemessagetype.md) | The supported types for console messages. |
| [CookiePriority](./puppeteer.cookiepriority.md) | Represents the cookie's 'Priority' status: https://tools.ietf.org/html/draft-west-cookie-priority-00 |
| [CookieSameSite](./puppeteer.cookiesamesite.md) | Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies |
| [CookieSourceScheme](./puppeteer.cookiesourcescheme.md) | Represents the source scheme of the origin that originally set the cookie. A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. This is a temporary ability and it will be removed in the future. |
| [ElementFor](./puppeteer.elementfor.md) | | | [ElementFor](./puppeteer.elementfor.md) | |
| [ErrorCode](./puppeteer.errorcode.md) | | | [ErrorCode](./puppeteer.errorcode.md) | |
| [EvaluateFunc](./puppeteer.evaluatefunc.md) | | | [EvaluateFunc](./puppeteer.evaluatefunc.md) | |
@ -189,7 +191,6 @@ sidebar_label: API
| [HandleOr](./puppeteer.handleor.md) | | | [HandleOr](./puppeteer.handleor.md) | |
| [Handler](./puppeteer.handler.md) | | | [Handler](./puppeteer.handler.md) | |
| [InnerParams](./puppeteer.innerparams.md) | | | [InnerParams](./puppeteer.innerparams.md) | |
| [InterceptResolutionStrategy](./puppeteer.interceptresolutionstrategy.md) | |
| [KeyInput](./puppeteer.keyinput.md) | All the valid keys that can be passed to functions that take user input, such as [keyboard.press](./puppeteer.keyboard.press.md) | | [KeyInput](./puppeteer.keyinput.md) | All the valid keys that can be passed to functions that take user input, such as [keyboard.press](./puppeteer.keyboard.press.md) |
| [KeyPressOptions](./puppeteer.keypressoptions.md) | | | [KeyPressOptions](./puppeteer.keypressoptions.md) | |
| [LocatorClickOptions](./puppeteer.locatorclickoptions.md) | | | [LocatorClickOptions](./puppeteer.locatorclickoptions.md) | |

View File

@ -1,10 +1,10 @@
--- ---
sidebar_label: Browser.createIncognitoBrowserContext sidebar_label: Browser.createBrowserContext
--- ---
# Browser.createIncognitoBrowserContext() method # Browser.createBrowserContext() method
Creates a new incognito [browser context](./puppeteer.browsercontext.md). Creates a new [browser context](./puppeteer.browsercontext.md).
This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md). This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md).
@ -12,7 +12,7 @@ This won't share cookies/cache with other [browser contexts](./puppeteer.browser
```typescript ```typescript
class Browser { class Browser {
abstract createIncognitoBrowserContext( abstract createBrowserContext(
options?: BrowserContextOptions options?: BrowserContextOptions
): Promise<BrowserContext>; ): Promise<BrowserContext>;
} }
@ -34,8 +34,8 @@ Promise&lt;[BrowserContext](./puppeteer.browsercontext.md)&gt;
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';
const browser = await puppeteer.launch(); const browser = await puppeteer.launch();
// Create a new incognito browser context. // Create a new browser context.
const context = await browser.createIncognitoBrowserContext(); const context = await browser.createBrowserContext();
// Create a new page in a pristine context. // Create a new page in a pristine context.
const page = await context.newPage(); const page = await context.newPage();
// Do stuff // Do stuff

View File

@ -64,10 +64,10 @@ await browser2.close();
## Methods ## Methods
| Method | Modifiers | Description | | Method | Modifiers | Description |
| ---------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ---------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [browserContexts()](./puppeteer.browser.browsercontexts.md) | | <p>Gets a list of open [browser contexts](./puppeteer.browsercontext.md).</p><p>In a newly-created [browser](./puppeteer.browser.md), this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md).</p> | | [browserContexts()](./puppeteer.browser.browsercontexts.md) | | <p>Gets a list of open [browser contexts](./puppeteer.browsercontext.md).</p><p>In a newly-created [browser](./puppeteer.browser.md), this will return a single instance of [BrowserContext](./puppeteer.browsercontext.md).</p> |
| [close()](./puppeteer.browser.close.md) | | Closes this [browser](./puppeteer.browser.md) and all associated [pages](./puppeteer.page.md). | | [close()](./puppeteer.browser.close.md) | | Closes this [browser](./puppeteer.browser.md) and all associated [pages](./puppeteer.page.md). |
| [createIncognitoBrowserContext(options)](./puppeteer.browser.createincognitobrowsercontext.md) | | <p>Creates a new incognito [browser context](./puppeteer.browsercontext.md).</p><p>This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md).</p> | | [createBrowserContext(options)](./puppeteer.browser.createbrowsercontext.md) | | <p>Creates a new [browser context](./puppeteer.browsercontext.md).</p><p>This won't share cookies/cache with other [browser contexts](./puppeteer.browsercontext.md).</p> |
| [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Gets the default [browser context](./puppeteer.browsercontext.md). | | [defaultBrowserContext()](./puppeteer.browser.defaultbrowsercontext.md) | | Gets the default [browser context](./puppeteer.browsercontext.md). |
| [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. | | [disconnect()](./puppeteer.browser.disconnect.md) | | Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves the process running. |
| [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). | | [isConnected()](./puppeteer.browser.isconnected.md) | | Whether Puppeteer is connected to this [browser](./puppeteer.browser.md). |

View File

@ -6,7 +6,7 @@ sidebar_label: BrowserContext.isIncognito
Whether this [browser context](./puppeteer.browsercontext.md) is incognito. Whether this [browser context](./puppeteer.browsercontext.md) is incognito.
The [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context. In Chrome, the [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context.
#### Signature: #### Signature:

View File

@ -4,9 +4,9 @@ sidebar_label: BrowserContext
# BrowserContext class # BrowserContext class
[BrowserContext](./puppeteer.browsercontext.md) represents individual sessions within a [browser](./puppeteer.browser.md). [BrowserContext](./puppeteer.browsercontext.md) represents individual user contexts within a [browser](./puppeteer.browser.md).
When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createIncognitoBrowserContext()](./puppeteer.browser.createincognitobrowsercontext.md). When a [browser](./puppeteer.browser.md) is launched, it has a single [browser context](./puppeteer.browsercontext.md) by default. Others can be created using [Browser.createBrowserContext()](./puppeteer.browser.createbrowsercontext.md). Each context has isolated storage (cookies/localStorage/etc.)
[BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum. [BrowserContext](./puppeteer.browsercontext.md) [emits](./puppeteer.eventemitter.md) various events which are documented in the [BrowserContextEvent](./puppeteer.browsercontextevent.md) enum.
@ -26,11 +26,11 @@ The constructor for this class is marked as internal. Third-party code should no
## Example ## Example
Creating an incognito [browser context](./puppeteer.browsercontext.md): Creating a new [browser context](./puppeteer.browsercontext.md):
```ts ```ts
// Create a new incognito browser context // Create a new browser context
const context = await browser.createIncognitoBrowserContext(); const context = await browser.createBrowserContext();
// Create a new page inside context. // Create a new page inside context.
const page = await context.newPage(); const page = await context.newPage();
// ... do stuff with page ... // ... do stuff with page ...
@ -49,11 +49,11 @@ await context.close();
## Methods ## Methods
| Method | Modifiers | Description | | Method | Modifiers | Description |
| --------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --------------------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [browser()](./puppeteer.browsercontext.browser.md) | | Gets the [browser](./puppeteer.browser.md) associated with this [browser context](./puppeteer.browsercontext.md). | | [browser()](./puppeteer.browsercontext.browser.md) | | Gets the [browser](./puppeteer.browser.md) associated with this [browser context](./puppeteer.browsercontext.md). |
| [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for this [browser context](./puppeteer.browsercontext.md). | | [clearPermissionOverrides()](./puppeteer.browsercontext.clearpermissionoverrides.md) | | Clears all permission overrides for this [browser context](./puppeteer.browsercontext.md). |
| [close()](./puppeteer.browsercontext.close.md) | | Closes this [browser context](./puppeteer.browsercontext.md) and all associated [pages](./puppeteer.page.md). | | [close()](./puppeteer.browsercontext.close.md) | | Closes this [browser context](./puppeteer.browsercontext.md) and all associated [pages](./puppeteer.page.md). |
| [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | <p>Whether this [browser context](./puppeteer.browsercontext.md) is incognito.</p><p>The [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context.</p> | | [isIncognito()](./puppeteer.browsercontext.isincognito.md) | | <p>Whether this [browser context](./puppeteer.browsercontext.md) is incognito.</p><p>In Chrome, the [default browser context](./puppeteer.browser.defaultbrowsercontext.md) is the only non-incognito browser context.</p> |
| [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new [page](./puppeteer.page.md) in this [browser context](./puppeteer.browsercontext.md). | | [newPage()](./puppeteer.browsercontext.newpage.md) | | Creates a new [page](./puppeteer.page.md) in this [browser context](./puppeteer.browsercontext.md). |
| [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | Grants this [browser context](./puppeteer.browsercontext.md) the given <code>permissions</code> within the given <code>origin</code>. | | [overridePermissions(origin, permissions)](./puppeteer.browsercontext.overridepermissions.md) | | Grants this [browser context](./puppeteer.browsercontext.md) the given <code>permissions</code> within the given <code>origin</code>. |
| [pages()](./puppeteer.browsercontext.pages.md) | | Gets a list of all open [pages](./puppeteer.page.md) inside this [browser context](./puppeteer.browsercontext.md). | | [pages()](./puppeteer.browsercontext.pages.md) | | Gets a list of all open [pages](./puppeteer.page.md) inside this [browser context](./puppeteer.browsercontext.md). |

View File

@ -0,0 +1,23 @@
---
sidebar_label: BrowserLaunchArgumentOptions
---
# BrowserLaunchArgumentOptions interface
Launcher options that only apply to Chrome.
#### Signature:
```typescript
export interface BrowserLaunchArgumentOptions
```
## Properties
| Property | Modifiers | Type | Description | Default |
| ------------- | --------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| args | <code>optional</code> | string\[\] | Additional command line arguments to pass to the browser instance. | |
| debuggingPort | <code>optional</code> | number | Specify the debugging port number to use | |
| devtools | <code>optional</code> | boolean | Whether to auto-open a DevTools panel for each tab. If this is set to <code>true</code>, then <code>headless</code> will be forced to <code>false</code>. | <code>false</code> |
| headless | <code>optional</code> | boolean \| 'shell' | Whether to run the browser in headless mode. | <code>true</code> |
| userDataDir | <code>optional</code> | string | Path to a user data directory. [see the Chromium docs](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/user_data_dir.md) for more info. | |

View File

@ -14,11 +14,9 @@ export interface CommonEventEmitter<Events extends Record<EventType, unknown>>
| Method | Description | | Method | Description |
| --------------------------------------------------------------------------------- | ----------- | | --------------------------------------------------------------------------------- | ----------- |
| [addListener(type, handler)](./puppeteer.commoneventemitter.addlistener.md) | |
| [emit(type, event)](./puppeteer.commoneventemitter.emit.md) | | | [emit(type, event)](./puppeteer.commoneventemitter.emit.md) | |
| [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | | | [listenerCount(event)](./puppeteer.commoneventemitter.listenercount.md) | |
| [off(type, handler)](./puppeteer.commoneventemitter.off.md) | | | [off(type, handler)](./puppeteer.commoneventemitter.off.md) | |
| [on(type, handler)](./puppeteer.commoneventemitter.on.md) | | | [on(type, handler)](./puppeteer.commoneventemitter.on.md) | |
| [once(type, handler)](./puppeteer.commoneventemitter.once.md) | | | [once(type, handler)](./puppeteer.commoneventemitter.once.md) | |
| [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | | | [removeAllListeners(event)](./puppeteer.commoneventemitter.removealllisteners.md) | |
| [removeListener(type, handler)](./puppeteer.commoneventemitter.removelistener.md) | |

View File

@ -22,7 +22,6 @@ export interface Configuration
| cacheDirectory | <code>optional</code> | string | <p>Defines the directory to be used by Puppeteer for caching.</p><p>Can be overridden by <code>PUPPETEER_CACHE_DIR</code>.</p> | <code>path.join(os.homedir(), '.cache', 'puppeteer')</code> | | cacheDirectory | <code>optional</code> | string | <p>Defines the directory to be used by Puppeteer for caching.</p><p>Can be overridden by <code>PUPPETEER_CACHE_DIR</code>.</p> | <code>path.join(os.homedir(), '.cache', 'puppeteer')</code> |
| defaultProduct | <code>optional</code> | [Product](./puppeteer.product.md) | <p>Specifies which browser you'd like Puppeteer to use.</p><p>Can be overridden by <code>PUPPETEER_PRODUCT</code>.</p> | <code>chrome</code> | | defaultProduct | <code>optional</code> | [Product](./puppeteer.product.md) | <p>Specifies which browser you'd like Puppeteer to use.</p><p>Can be overridden by <code>PUPPETEER_PRODUCT</code>.</p> | <code>chrome</code> |
| downloadBaseUrl | <code>optional</code> | string | <p>Specifies the URL prefix that is used to download the browser.</p><p>Can be overridden by <code>PUPPETEER_DOWNLOAD_BASE_URL</code>.</p> | Either https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central, depending on the product. | | downloadBaseUrl | <code>optional</code> | string | <p>Specifies the URL prefix that is used to download the browser.</p><p>Can be overridden by <code>PUPPETEER_DOWNLOAD_BASE_URL</code>.</p> | Either https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central, depending on the product. |
| downloadPath | <code>optional</code> | string | <p>Specifies the path for the downloads folder.</p><p>Can be overridden by <code>PUPPETEER_DOWNLOAD_PATH</code>.</p> | <code>&lt;cacheDirectory&gt;</code> |
| executablePath | <code>optional</code> | string | <p>Specifies an executable path to be used in [puppeteer.launch](./puppeteer.puppeteernode.launch.md).</p><p>Can be overridden by <code>PUPPETEER_EXECUTABLE_PATH</code>.</p> | **Auto-computed.** | | executablePath | <code>optional</code> | string | <p>Specifies an executable path to be used in [puppeteer.launch](./puppeteer.puppeteernode.launch.md).</p><p>Can be overridden by <code>PUPPETEER_EXECUTABLE_PATH</code>.</p> | **Auto-computed.** |
| experiments | <code>optional</code> | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) | Defines experimental options for Puppeteer. | | | experiments | <code>optional</code> | [ExperimentsConfiguration](./puppeteer.experimentsconfiguration.md) | Defines experimental options for Puppeteer. | |
| logLevel | <code>optional</code> | 'silent' \| 'error' \| 'warn' | Tells Puppeteer to log at the given level. | <code>warn</code> | | logLevel | <code>optional</code> | 'silent' \| 'error' \| 'warn' | Tells Puppeteer to log at the given level. | <code>warn</code> |

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