chore: release main (#9143)
This commit is contained in:
parent
ec201744f0
commit
4bf338b26d
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"packages/puppeteer": "19.0.0",
|
"packages/puppeteer": "19.1.0",
|
||||||
"packages/puppeteer-core": "19.0.0",
|
"packages/puppeteer-core": "19.1.0",
|
||||||
"packages/testserver": "0.6.0"
|
"packages/testserver": "0.6.0"
|
||||||
}
|
}
|
||||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@ -8464,7 +8464,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/puppeteer": {
|
"packages/puppeteer": {
|
||||||
"version": "19.0.0",
|
"version": "19.1.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -8472,14 +8472,14 @@
|
|||||||
"https-proxy-agent": "5.0.1",
|
"https-proxy-agent": "5.0.1",
|
||||||
"progress": "2.0.3",
|
"progress": "2.0.3",
|
||||||
"proxy-from-env": "1.1.0",
|
"proxy-from-env": "1.1.0",
|
||||||
"puppeteer-core": "19.0.0"
|
"puppeteer-core": "19.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.1.0"
|
"node": ">=14.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/puppeteer-core": {
|
"packages/puppeteer-core": {
|
||||||
"version": "19.0.0",
|
"version": "19.1.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-fetch": "3.1.5",
|
"cross-fetch": "3.1.5",
|
||||||
@ -13301,7 +13301,7 @@
|
|||||||
"https-proxy-agent": "5.0.1",
|
"https-proxy-agent": "5.0.1",
|
||||||
"progress": "2.0.3",
|
"progress": "2.0.3",
|
||||||
"proxy-from-env": "1.1.0",
|
"proxy-from-env": "1.1.0",
|
||||||
"puppeteer-core": "19.0.0"
|
"puppeteer-core": "19.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"puppeteer-core": {
|
"puppeteer-core": {
|
||||||
|
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [19.1.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v19.0.0...puppeteer-core-v19.1.0) (2022-10-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* expose browser context id ([#9134](https://github.com/puppeteer/puppeteer/issues/9134)) ([122778a](https://github.com/puppeteer/puppeteer/commit/122778a1f8b60e0dcc6f0ffcb2097e95ae98f4a3)), closes [#9132](https://github.com/puppeteer/puppeteer/issues/9132)
|
||||||
|
* use configuration files ([#9140](https://github.com/puppeteer/puppeteer/issues/9140)) ([ec20174](https://github.com/puppeteer/puppeteer/commit/ec201744f077987b288e3dff52c0906fe700f6fb)), closes [#9128](https://github.com/puppeteer/puppeteer/issues/9128)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update `BrowserFetcher` deprecation message ([#9141](https://github.com/puppeteer/puppeteer/issues/9141)) ([efcbc97](https://github.com/puppeteer/puppeteer/commit/efcbc97c60e4cfd49a9ed25a900f6133d06b290b))
|
||||||
|
|
||||||
## [19.0.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v18.2.1...puppeteer-core-v19.0.0) (2022-10-14)
|
## [19.0.0](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v18.2.1...puppeteer-core-v19.0.0) (2022-10-14)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "puppeteer-core",
|
"name": "puppeteer-core",
|
||||||
"version": "19.0.0",
|
"version": "19.1.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",
|
||||||
|
@ -2,6 +2,25 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [19.1.0](https://github.com/puppeteer/puppeteer/compare/v19.0.0...v19.1.0) (2022-10-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* use configuration files ([#9140](https://github.com/puppeteer/puppeteer/issues/9140)) ([ec20174](https://github.com/puppeteer/puppeteer/commit/ec201744f077987b288e3dff52c0906fe700f6fb)), closes [#9128](https://github.com/puppeteer/puppeteer/issues/9128)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* update `BrowserFetcher` deprecation message ([#9141](https://github.com/puppeteer/puppeteer/issues/9141)) ([efcbc97](https://github.com/puppeteer/puppeteer/commit/efcbc97c60e4cfd49a9ed25a900f6133d06b290b))
|
||||||
|
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
* The following workspace dependencies were updated
|
||||||
|
* dependencies
|
||||||
|
* puppeteer-core bumped from 19.0.0 to ^19.1.0
|
||||||
|
|
||||||
## [19.0.0](https://github.com/puppeteer/puppeteer/compare/v18.2.1...v19.0.0) (2022-10-14)
|
## [19.0.0](https://github.com/puppeteer/puppeteer/compare/v18.2.1...v19.0.0) (2022-10-14)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "puppeteer",
|
"name": "puppeteer",
|
||||||
"version": "19.0.0",
|
"version": "19.1.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",
|
||||||
@ -139,6 +139,6 @@
|
|||||||
"https-proxy-agent": "5.0.1",
|
"https-proxy-agent": "5.0.1",
|
||||||
"progress": "2.0.3",
|
"progress": "2.0.3",
|
||||||
"proxy-from-env": "1.1.0",
|
"proxy-from-env": "1.1.0",
|
||||||
"puppeteer-core": "19.0.0"
|
"puppeteer-core": "19.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: BrowserFetcherOptions
|
|
||||||
---
|
|
||||||
|
|
||||||
# BrowserFetcherOptions interface
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface BrowserFetcherOptions
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
|
||||||
| ---------------------------------------------------------- | --------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
||||||
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> Determines the host that will be used for downloading. |
|
|
||||||
| [path?](./puppeteer.browserfetcheroptions.path.md) | | string | <i>(Optional)</i> Determines the path to download browsers to. |
|
|
||||||
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> Determines which platform the browser will be suited for. |
|
|
||||||
| [product?](./puppeteer.browserfetcheroptions.product.md) | | 'chrome' \| 'firefox' | <i>(Optional)</i> Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. |
|
|
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: createBrowserFetcher
|
|
||||||
---
|
|
||||||
|
|
||||||
# createBrowserFetcher variable
|
|
||||||
|
|
||||||
> Warning: This API is now obsolete.
|
|
||||||
>
|
|
||||||
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
createBrowserFetcher: (
|
|
||||||
options: import('puppeteer-core/internal/node/BrowserFetcher.js').BrowserFetcherOptions
|
|
||||||
) => import('puppeteer-core/internal/node/BrowserFetcher.js').BrowserFetcher;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: executablePath
|
|
||||||
---
|
|
||||||
|
|
||||||
# executablePath variable
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
executablePath: (channel?: string | undefined) => string;
|
|
||||||
```
|
|
@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: ProductLauncher.executablePath
|
|
||||||
---
|
|
||||||
|
|
||||||
# ProductLauncher.executablePath property
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
interface ProductLauncher {
|
|
||||||
executablePath: (path?: any) => string;
|
|
||||||
}
|
|
||||||
```
|
|
@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: ProductLauncher
|
|
||||||
---
|
|
||||||
|
|
||||||
# ProductLauncher interface
|
|
||||||
|
|
||||||
Describes a launcher - a class that is able to create and launch a browser instance.
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface ProductLauncher
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
|
||||||
| --------------------------------------------------------------- | --------- | --------------------------------- | ----------- |
|
|
||||||
| [executablePath](./puppeteer.productlauncher.executablepath.md) | | (path?: any) => string | |
|
|
||||||
| [product](./puppeteer.productlauncher.product.md) | | [Product](./puppeteer.product.md) | |
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Description |
|
|
||||||
| ----------------------------------------------------------------- | ----------- |
|
|
||||||
| [defaultArgs(object)](./puppeteer.productlauncher.defaultargs.md) | |
|
|
||||||
| [launch(object)](./puppeteer.productlauncher.launch.md) | |
|
|
@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: PuppeteerNode.createBrowserFetcher
|
|
||||||
---
|
|
||||||
|
|
||||||
# PuppeteerNode.createBrowserFetcher() method
|
|
||||||
|
|
||||||
> Warning: This API is now obsolete.
|
|
||||||
>
|
|
||||||
> Import [BrowserFetcher](./puppeteer.browserfetcher.md) directly and use the constructor.
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
class PuppeteerNode {
|
|
||||||
createBrowserFetcher(options: BrowserFetcherOptions): BrowserFetcher;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
||||||
| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | Set of configurable options to specify the settings of the BrowserFetcher. |
|
|
||||||
|
|
||||||
**Returns:**
|
|
||||||
|
|
||||||
[BrowserFetcher](./puppeteer.browserfetcher.md)
|
|
||||||
|
|
||||||
A new BrowserFetcher instance.
|
|
@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: PuppeteerNode.executablePath
|
|
||||||
---
|
|
||||||
|
|
||||||
# PuppeteerNode.executablePath() method
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
class PuppeteerNode {
|
|
||||||
executablePath(channel?: string): string;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --------- | ------ | ----------------- |
|
|
||||||
| channel | string | <i>(Optional)</i> |
|
|
||||||
|
|
||||||
**Returns:**
|
|
||||||
|
|
||||||
string
|
|
||||||
|
|
||||||
A path where Puppeteer expects to find the bundled browser. The browser binary might not be there if the download was skipped with the `PUPPETEER_SKIP_DOWNLOAD` environment variable.
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
**NOTE** `puppeteer.executablePath()` is affected by the `PUPPETEER_EXECUTABLE_PATH` and `PUPPETEER_CHROMIUM_REVISION` environment variables.
|
|
@ -1,41 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: PuppeteerNode.launch
|
|
||||||
---
|
|
||||||
|
|
||||||
# PuppeteerNode.launch() method
|
|
||||||
|
|
||||||
Launches puppeteer and launches a browser instance with given arguments and options when specified.
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
class PuppeteerNode {
|
|
||||||
launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --------- | --------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
||||||
| options | [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | <i>(Optional)</i> Set of configurable options to set on the browser. |
|
|
||||||
|
|
||||||
**Returns:**
|
|
||||||
|
|
||||||
Promise<[Browser](./puppeteer.browser.md)>
|
|
||||||
|
|
||||||
Promise which resolves to browser instance.
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
**NOTE** Puppeteer can also be used to control the Chrome browser, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use `executablePath` option with extreme caution. If Google Chrome (rather than Chromium) is preferred, a [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested. In `puppeteer.launch([options])`, any mention of Chromium also applies to Chrome. 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/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const browser = await puppeteer.launch({
|
|
||||||
ignoreDefaultArgs: ['--mute-audio'],
|
|
||||||
});
|
|
||||||
```
|
|
@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: PuppeteerNode.product
|
|
||||||
---
|
|
||||||
|
|
||||||
# PuppeteerNode.product property
|
|
||||||
|
|
||||||
The name of the browser that is under automation (`"chrome"` or `"firefox"`)
|
|
||||||
|
|
||||||
**Signature:**
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
class PuppeteerNode {
|
|
||||||
get product(): string;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Remarks
|
|
||||||
|
|
||||||
The product is set by the `PUPPETEER_PRODUCT` environment variable or the `product` option in `puppeteer.launch([options])` and defaults to `chrome`. Firefox support is experimental.
|
|
@ -1,154 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
# FAQ
|
|
||||||
|
|
||||||
## Q: Who maintains Puppeteer?
|
|
||||||
|
|
||||||
The Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!
|
|
||||||
See our [contributing guide](https://pptr.dev/contributing).
|
|
||||||
|
|
||||||
## Q: What is the status of cross-browser support?
|
|
||||||
|
|
||||||
Official Firefox support is currently experimental. The ongoing collaboration with Mozilla aims to support common end-to-end testing use cases, for which developers expect cross-browser coverage. The Puppeteer team needs input from users to stabilize Firefox support and to bring missing APIs to our attention.
|
|
||||||
|
|
||||||
From Puppeteer v2.1.0 onwards you can specify [`puppeteer.launch({product: 'firefox'})`](https://pptr.dev/api/puppeteer.puppeteernode.launch) to run your Puppeteer scripts in Firefox Nightly, without any additional custom patches. While [an older experiment](https://www.npmjs.com/package/puppeteer-firefox) required a patched version of Firefox, [the current approach](https://wiki.mozilla.org/Remote) works with “stock” Firefox.
|
|
||||||
|
|
||||||
We will continue to collaborate with other browser vendors to bring Puppeteer support to browsers such as Safari.
|
|
||||||
This effort includes exploration of a standard for executing cross-browser commands (instead of relying on the non-standard DevTools Protocol used by Chrome).
|
|
||||||
|
|
||||||
## Q: What are Puppeteer’s goals and principles?
|
|
||||||
|
|
||||||
The goals of the project are:
|
|
||||||
|
|
||||||
- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).
|
|
||||||
- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.
|
|
||||||
- Grow the adoption of headless/automated browser testing.
|
|
||||||
- Help dogfood new DevTools Protocol features...and catch bugs!
|
|
||||||
- Learn more about the pain points of automated browser testing and help fill those gaps.
|
|
||||||
|
|
||||||
We adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:
|
|
||||||
|
|
||||||
- **Speed**: Puppeteer has almost zero performance overhead over an automated page.
|
|
||||||
- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.
|
|
||||||
- **Stability**: Puppeteer should not be flaky and should not leak memory.
|
|
||||||
- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.
|
|
||||||
|
|
||||||
## Q: Is Puppeteer replacing Selenium/WebDriver?
|
|
||||||
|
|
||||||
**No**. Both projects are valuable for very different reasons:
|
|
||||||
|
|
||||||
- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.
|
|
||||||
- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.
|
|
||||||
|
|
||||||
That said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:
|
|
||||||
|
|
||||||
- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/puppeteer/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.
|
|
||||||
- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.
|
|
||||||
- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.
|
|
||||||
- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.
|
|
||||||
|
|
||||||
## Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?
|
|
||||||
|
|
||||||
We see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.
|
|
||||||
|
|
||||||
This is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:
|
|
||||||
|
|
||||||
- A Puppeteer bug is reported: https://github.com/puppeteer/puppeteer/issues/2709
|
|
||||||
- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154
|
|
||||||
- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/puppeteer/puppeteer/pull/2769
|
|
||||||
|
|
||||||
However, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.
|
|
||||||
|
|
||||||
For example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install puppeteer-core@chrome-71
|
|
||||||
```
|
|
||||||
|
|
||||||
## Q: Which Chromium version does Puppeteer use?
|
|
||||||
|
|
||||||
Find the version using one of the following ways:
|
|
||||||
|
|
||||||
- Look for the `chromium` entry in [revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/src/revisions.ts). To find the corresponding Chromium commit and version number, search for the revision prefixed by an `r` in [OmahaProxy](https://omahaproxy.appspot.com/)'s "Find Releases" section.
|
|
||||||
- Look for the `versionsPerRelease` map in [versions.js](https://github.com/puppeteer/puppeteer/blob/main/versions.js) which contains mapping between Chromium and the smallest Puppeteer version that supports it.
|
|
||||||
|
|
||||||
## Q: Which Firefox version does Puppeteer use?
|
|
||||||
|
|
||||||
Since Firefox support is experimental, Puppeteer downloads the latest [Firefox Nightly](https://wiki.mozilla.org/Nightly) when the `PUPPETEER_PRODUCT` environment variable is set to `firefox`. That's also why the value of `firefox` in [revisions.ts](https://github.com/puppeteer/puppeteer/blob/main/src/revisions.ts) is `latest` -- Puppeteer isn't tied to a particular Firefox version.
|
|
||||||
|
|
||||||
To fetch Firefox Nightly as part of Puppeteer installation:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
PUPPETEER_PRODUCT=firefox npm i puppeteer
|
|
||||||
# or "yarn add puppeteer"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Q: What’s considered a “Navigation”?
|
|
||||||
|
|
||||||
From Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.
|
|
||||||
Aside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.
|
|
||||||
|
|
||||||
With this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**
|
|
||||||
|
|
||||||
#### Q: What’s the difference between a “trusted" and "untrusted" input event?
|
|
||||||
|
|
||||||
In browsers, input events could be divided into two big groups: trusted vs. untrusted.
|
|
||||||
|
|
||||||
- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.
|
|
||||||
- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.
|
|
||||||
|
|
||||||
Websites can distinguish between these two groups:
|
|
||||||
|
|
||||||
- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag
|
|
||||||
- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.
|
|
||||||
|
|
||||||
For automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
await page.evaluate(() => {
|
|
||||||
document.querySelector('button[type=submit]').click();
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Q: What features does Puppeteer not support?
|
|
||||||
|
|
||||||
You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/puppeteer/puppeteer/issues/291).) There are two reasons for this:
|
|
||||||
|
|
||||||
- Puppeteer is bundled with Chromium — not Chrome — and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://pptr.dev/api/puppeteer.launchoptions.executablepath). You should only use this configuration if you need an official release of Chrome that supports these media formats.)
|
|
||||||
- Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).
|
|
||||||
|
|
||||||
#### Q: I am having trouble installing / running Puppeteer in my test environment. Where should I look for help?
|
|
||||||
|
|
||||||
We have a [troubleshooting](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.
|
|
||||||
|
|
||||||
#### Q: Chromium gets downloaded on every `npm ci` run. How can I cache the download?
|
|
||||||
|
|
||||||
The default download path is `node_modules/puppeteer/.local-chromium`. However, you can change that path with the `PUPPETEER_DOWNLOAD_PATH` environment variable.
|
|
||||||
|
|
||||||
Puppeteer uses that variable to resolve the Chromium executable location during launch, so you don’t need to specify `PUPPETEER_EXECUTABLE_PATH` as well.
|
|
||||||
|
|
||||||
For example, if you wish to keep the Chromium download in `~/.npm/chromium`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
export PUPPETEER_DOWNLOAD_PATH=~/.npm/chromium
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
# by default the Chromium executable path is inferred
|
|
||||||
# from the download path
|
|
||||||
npm test
|
|
||||||
|
|
||||||
# a new run of npm ci will check for the existence of
|
|
||||||
# Chromium in ~/.npm/chromium
|
|
||||||
npm ci
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Q: I have more questions! Where do I ask?
|
|
||||||
|
|
||||||
There are many ways to get help on Puppeteer:
|
|
||||||
|
|
||||||
- [bugtracker](https://github.com/puppeteer/puppeteer/issues)
|
|
||||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/puppeteer)
|
|
||||||
|
|
||||||
Make sure to search these channels before posting your question.
|
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: Guides
|
|
||||||
sidebar_position: 6
|
|
||||||
---
|
|
||||||
|
|
||||||
- [Request interception](request-interception.md)
|
|
@ -1,175 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 1
|
|
||||||
---
|
|
||||||
|
|
||||||
# Puppeteer
|
|
||||||
|
|
||||||
[![Build status](https://github.com/puppeteer/puppeteer/workflows/CI/badge.svg)](https://github.com/puppeteer/puppeteer/actions?query=workflow%3ACI) [![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"/>
|
|
||||||
|
|
||||||
#### [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://developers.google.com/web/updates/2017/04/headless-chrome) mode by default, but can be configured to run in full (non-headless) 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://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.
|
|
||||||
- Test Chrome Extensions.
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
To use Puppeteer in your project, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i puppeteer
|
|
||||||
# or `yarn add puppeteer`
|
|
||||||
# or `pnpm i puppeteer`
|
|
||||||
```
|
|
||||||
|
|
||||||
When you install Puppeteer, it automatically downloads a recent version of Chromium (~170MB macOS, ~282MB Linux, ~280MB Windows) that is [guaranteed to work](https://pptr.dev/faq#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy) with Puppeteer. For a version of Puppeteer without installation, see [`puppeteer-core`](#puppeteer-core).
|
|
||||||
|
|
||||||
#### Environment Variables
|
|
||||||
|
|
||||||
Puppeteer looks for certain [environment variables](https://en.wikipedia.org/wiki/Environment_variable) for customizing behavior.
|
|
||||||
If Puppeteer doesn't find them in the environment during the installation step, a lowercased variant of these variables will be used from the [npm config](https://docs.npmjs.com/cli/config).
|
|
||||||
|
|
||||||
- `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` - defines HTTP proxy settings that are used to download and run the browser.
|
|
||||||
- `PUPPETEER_CACHE_DIR` - defines the directory to be used by Puppeteer for caching. Defaults to [`os.homedir()/.cache/puppeteer`](https://nodejs.org/api/os.html#os_os_homedir).
|
|
||||||
- `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` - do not download bundled Chromium during installation step.
|
|
||||||
- `PUPPETEER_TMP_DIR` - defines the directory to be used by Puppeteer for creating temporary files. Defaults to [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir).
|
|
||||||
- `PUPPETEER_DOWNLOAD_HOST` - specifies the URL prefix that is used to download Chromium. Note: this includes protocol and might even include path prefix. Defaults to `https://storage.googleapis.com`.
|
|
||||||
- `PUPPETEER_DOWNLOAD_PATH` - specifies the path for the downloads folder. Defaults to `<cache>/chromium`, where `<cache>` is Puppeteer's cache directory.
|
|
||||||
- `PUPPETEER_BROWSER_REVISION` - specifies a certain version of the browser you'd like Puppeteer to use. See [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) on how executable path is inferred.
|
|
||||||
- `PUPPETEER_EXECUTABLE_PATH` - specifies an executable path to be used in [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch).
|
|
||||||
- `PUPPETEER_PRODUCT` - specifies which browser you'd like Puppeteer to use. Must be either `chrome` or `firefox`. This can also be used during installation to fetch the recommended browser binary. Setting `product` programmatically in [`puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) supersedes this environment variable.
|
|
||||||
- `PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM` — specify Puppeteer download Chromium for Apple M1. On Apple M1 devices Puppeteer by default downloads the version for Intel's processor which runs via Rosetta. It works without any problems, however, with this option, you should get more efficient resource usage (CPU and RAM) that could lead to a faster execution time.
|
|
||||||
|
|
||||||
Environment variables except for `PUPPETEER_CACHE_DIR` are not used for [`puppeteer-core`](#puppeteer-core) since core does not automatically handle browser downloading.
|
|
||||||
|
|
||||||
#### `puppeteer-core`
|
|
||||||
|
|
||||||
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
|
|
||||||
Chromium, which it then drives using `puppeteer-core`. Being an end-user product, `puppeteer` supports a bunch of convenient `PUPPETEER_*` env variables to tweak its behavior.
|
|
||||||
|
|
||||||
`puppeteer-core` is a _library_ to help drive anything that supports DevTools protocol. `puppeteer-core` doesn't download Chromium when installed. Being a library, `puppeteer-core` is fully driven through its programmatic interface.
|
|
||||||
|
|
||||||
You should only 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/api/puppeteer.browserfetcher). 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.executablepath) or [`channel`](https://pptr.dev/api/puppeteer.launchoptions.channel).
|
|
||||||
|
|
||||||
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/guides) and [examples](https://github.com/puppeteer/puppeteer/tree/main/examples).
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
|
|
||||||
The following example searches [developers.google.com/web](https://developers.google.com/web) for articles tagged "Headless Chrome" and scrape results from the results page.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import puppeteer from 'puppeteer';
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const browser = await puppeteer.launch();
|
|
||||||
const page = await browser.newPage();
|
|
||||||
|
|
||||||
await page.goto('https://developers.google.com/web/');
|
|
||||||
|
|
||||||
// Type into search box.
|
|
||||||
await page.type('.devsite-search-field', 'Headless Chrome');
|
|
||||||
|
|
||||||
// Wait for suggest overlay to appear and click "show all results".
|
|
||||||
const allResultsSelector = '.devsite-suggest-all-results';
|
|
||||||
await page.waitForSelector(allResultsSelector);
|
|
||||||
await page.click(allResultsSelector);
|
|
||||||
|
|
||||||
// Wait for the results page to load and display the results.
|
|
||||||
const resultsSelector = '.gsc-results .gs-title';
|
|
||||||
await page.waitForSelector(resultsSelector);
|
|
||||||
|
|
||||||
// Extract the results from the page.
|
|
||||||
const links = await page.evaluate(resultsSelector => {
|
|
||||||
return [...document.querySelectorAll(resultsSelector)].map(anchor => {
|
|
||||||
const title = anchor.textContent.split('|')[0].trim();
|
|
||||||
return `${title} - ${anchor.href}`;
|
|
||||||
});
|
|
||||||
}, resultsSelector);
|
|
||||||
|
|
||||||
// Print all the files.
|
|
||||||
console.log(links.join('\n'));
|
|
||||||
|
|
||||||
await browser.close();
|
|
||||||
})();
|
|
||||||
```
|
|
||||||
|
|
||||||
### Default runtime settings
|
|
||||||
|
|
||||||
**1. Uses Headless mode**
|
|
||||||
|
|
||||||
Puppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the [`headless`](https://pptr.dev/api/puppeteer.browserlaunchargumentoptions.headless) option when launching a browser:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const browser = await puppeteer.launch({headless: false}); // default is true
|
|
||||||
```
|
|
||||||
|
|
||||||
**2. Runs a bundled version of Chromium**
|
|
||||||
|
|
||||||
By default, Puppeteer downloads and uses a specific version of Chromium 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 Nightly (experimental support). See [`Puppeteer.launch`](https://pptr.dev/api/puppeteer.puppeteernode.launch) 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 [guide on using Docker](https://pptr.dev/guides/docker).
|
|
||||||
|
|
||||||
#### Using Chrome Extensions
|
|
||||||
|
|
||||||
See our [guide on using Chrome extensions](https://pptr.dev/guides/chrome-extensions).
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
- [API Documentation](https://pptr.dev/api)
|
|
||||||
- [Guides](https://pptr.dev/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).
|
|
@ -30,6 +30,7 @@ sidebar_label: API
|
|||||||
| [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. |
|
| [Keyboard](./puppeteer.keyboard.md) | Keyboard provides an api for managing a virtual keyboard. The high level api is [Keyboard.type()](./puppeteer.keyboard.type.md), which takes raw characters and generates proper keydown, keypress/input, and keyup events on your page. |
|
||||||
| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. |
|
| [Mouse](./puppeteer.mouse.md) | The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport. |
|
||||||
| [Page](./puppeteer.page.md) | <p>Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium.</p><p>:::note</p><p>One Browser instance might have multiple Page instances.</p><p>:::</p> |
|
| [Page](./puppeteer.page.md) | <p>Page provides methods to interact with a single tab or [extension background page](https://developer.chrome.com/extensions/background_pages) in Chromium.</p><p>:::note</p><p>One Browser instance might have multiple Page instances.</p><p>:::</p> |
|
||||||
|
| [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> |
|
||||||
| [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> |
|
||||||
@ -72,6 +73,7 @@ sidebar_label: API
|
|||||||
| [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | |
|
| [CDPSessionOnMessageObject](./puppeteer.cdpsessiononmessageobject.md) | |
|
||||||
| [ClickOptions](./puppeteer.clickoptions.md) | |
|
| [ClickOptions](./puppeteer.clickoptions.md) | |
|
||||||
| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | |
|
| [CommonEventEmitter](./puppeteer.commoneventemitter.md) | |
|
||||||
|
| [Configuration](./puppeteer.configuration.md) | |
|
||||||
| [ConnectionCallback](./puppeteer.connectioncallback.md) | |
|
| [ConnectionCallback](./puppeteer.connectioncallback.md) | |
|
||||||
| [ConnectionTransport](./puppeteer.connectiontransport.md) | |
|
| [ConnectionTransport](./puppeteer.connectiontransport.md) | |
|
||||||
| [ConnectOptions](./puppeteer.connectoptions.md) | |
|
| [ConnectOptions](./puppeteer.connectoptions.md) | |
|
||||||
@ -102,7 +104,6 @@ sidebar_label: API
|
|||||||
| [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) | |
|
||||||
| [PressOptions](./puppeteer.pressoptions.md) | |
|
| [PressOptions](./puppeteer.pressoptions.md) | |
|
||||||
| [ProductLauncher](./puppeteer.productlauncher.md) | Describes a launcher - a class that is able to create and launch a browser instance. |
|
|
||||||
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
|
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
|
||||||
| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | |
|
| [PuppeteerLaunchOptions](./puppeteer.puppeteerlaunchoptions.md) | |
|
||||||
| [RemoteAddress](./puppeteer.remoteaddress.md) | |
|
| [RemoteAddress](./puppeteer.remoteaddress.md) | |
|
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: BrowserContext.id
|
||||||
|
---
|
||||||
|
|
||||||
|
# BrowserContext.id property
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class BrowserContext {
|
||||||
|
get id(): string | undefined;
|
||||||
|
}
|
||||||
|
```
|
@ -37,6 +37,12 @@ await page.goto('https://example.com');
|
|||||||
await context.close();
|
await context.close();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Modifiers | Type | Description |
|
||||||
|
| -------------------------------------- | --------------------- | ------------------- | ----------- |
|
||||||
|
| [id](./puppeteer.browsercontext.id.md) | <code>readonly</code> | string \| undefined | |
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
| Method | Modifiers | Description |
|
| Method | Modifiers | Description |
|
@ -10,12 +10,12 @@ Constructs a browser fetcher for the given options.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class BrowserFetcher {
|
class BrowserFetcher {
|
||||||
constructor(options?: BrowserFetcherOptions);
|
constructor(options: BrowserFetcherOptions);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --------- | ------------------------------------------------------------- | ----------------- |
|
| --------- | ------------------------------------------------------------- | ----------- |
|
||||||
| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | <i>(Optional)</i> |
|
| options | [BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md) | |
|
@ -8,15 +8,15 @@ sidebar_label: BrowserFetcher.localRevisions
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class BrowserFetcher {
|
class BrowserFetcher {
|
||||||
localRevisions(): Promise<string[]>;
|
localRevisions(): string[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
Promise<string\[\]>
|
string\[\]
|
||||||
|
|
||||||
A promise with a list of all revision strings (for the current `product`) available locally on disk.
|
A list of all revision strings (for the current `product`) available locally on disk.
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
|
@ -21,7 +21,7 @@ BrowserFetcher is not designed to work concurrently with other instances of Brow
|
|||||||
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
|
An example of using BrowserFetcher to download a specific version of Chromium and running Puppeteer against it:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const browserFetcher = new BrowserFetcher();
|
const browserFetcher = new BrowserFetcher({path: 'path/to/download/folder'});
|
||||||
const revisionInfo = await browserFetcher.download('533271');
|
const revisionInfo = await browserFetcher.download('533271');
|
||||||
const browser = await puppeteer.launch({
|
const browser = await puppeteer.launch({
|
||||||
executablePath: revisionInfo.executablePath,
|
executablePath: revisionInfo.executablePath,
|
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: BrowserFetcherOptions
|
||||||
|
---
|
||||||
|
|
||||||
|
# BrowserFetcherOptions interface
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export interface BrowserFetcherOptions
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Property | Modifiers | Type | Description |
|
||||||
|
| ---------------------------------------------------------------------------- | --------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
||||||
|
| [host?](./puppeteer.browserfetcheroptions.host.md) | | string | <i>(Optional)</i> Determines the host that will be used for downloading. |
|
||||||
|
| [path](./puppeteer.browserfetcheroptions.path.md) | | string | Determines the path to download browsers to. |
|
||||||
|
| [platform?](./puppeteer.browserfetcheroptions.platform.md) | | [Platform](./puppeteer.platform.md) | <i>(Optional)</i> Determines which platform the browser will be suited for. |
|
||||||
|
| [product?](./puppeteer.browserfetcheroptions.product.md) | | 'chrome' \| 'firefox' | <i>(Optional)</i> Determines which product the [BrowserFetcher](./puppeteer.browserfetcher.md) is for. |
|
||||||
|
| [useMacOSARMBinary?](./puppeteer.browserfetcheroptions.usemacosarmbinary.md) | | boolean | <i>(Optional)</i> Enables the use of the Chromium binary for macOS ARM. |
|
@ -10,6 +10,6 @@ Determines the path to download browsers to.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface BrowserFetcherOptions {
|
interface BrowserFetcherOptions {
|
||||||
path?: string;
|
path: string;
|
||||||
}
|
}
|
||||||
```
|
```
|
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: BrowserFetcherOptions.useMacOSARMBinary
|
||||||
|
---
|
||||||
|
|
||||||
|
# BrowserFetcherOptions.useMacOSARMBinary property
|
||||||
|
|
||||||
|
Enables the use of the Chromium binary for macOS ARM.
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface BrowserFetcherOptions {
|
||||||
|
useMacOSARMBinary?: boolean;
|
||||||
|
}
|
||||||
|
```
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user