Go to file
dependabot[bot] cd8eec3222
chore(deps): Bump @angular-devkit/schematics from 14.2.8 to 15.0.3 (#9413)
Bumps
[@angular-devkit/schematics](https://github.com/angular/angular-cli)
from 14.2.8 to 15.0.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/angular/angular-cli/releases"><code>@​angular-devkit/schematics</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v15.0.3</h2>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h1>15.0.3 (2022-12-07)</h1>
<h3><code>@​angular-devkit/build-angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="3d9971edb0"><img
src="https://img.shields.io/badge/3d9971edb-fix-green" alt="fix -
3d9971edb" /></a></td>
<td>default preserve symlinks to Node.js value for esbuild</td>
</tr>
<tr>
<td><a
href="24f4b51d22"><img
src="https://img.shields.io/badge/24f4b51d2-fix-green" alt="fix -
24f4b51d2" /></a></td>
<td>downlevel class fields with Safari &lt;= v15 for esbuild</td>
</tr>
<tr>
<td><a
href="45afc42db8"><img
src="https://img.shields.io/badge/45afc42db-fix-green" alt="fix -
45afc42db" /></a></td>
<td>downlevel class properties when targeting Safari &lt;=v15</td>
</tr>
<tr>
<td><a
href="e6461badf7"><img
src="https://img.shields.io/badge/e6461badf-fix-green" alt="fix -
e6461badf" /></a></td>
<td>prevent optimization adding unsupported ECMASCript features</td>
</tr>
</tbody>
</table>
<h2>Special Thanks</h2>
<p>Charles Lyding, Dominic Elm and Paul Gschwendtner</p>
<h2>v15.0.2</h2>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h1>15.0.2 (2022-11-30)</h1>
<h3><code>@​angular-devkit/build-angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="2891d5bc9e"><img
src="https://img.shields.io/badge/2891d5bc9-fix-green" alt="fix -
2891d5bc9" /></a></td>
<td>correctly set Sass quietDeps and verbose options</td>
</tr>
</tbody>
</table>
<h3><code>@​ngtools/webpack</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="d9cc4b0289"><img
src="https://img.shields.io/badge/d9cc4b028-fix-green" alt="fix -
d9cc4b028" /></a></td>
<td>elide unused type references</td>
</tr>
</tbody>
</table>
<h2>Special Thanks</h2>
<p>Alan Agius and Juuso Valkeejärvi</p>
<h2>v15.0.1</h2>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h1>15.0.1 (2022-11-23)</h1>
<h3><code>@​schematics/angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="48426852b0"><img
src="https://img.shields.io/badge/48426852b-fix-green" alt="fix -
48426852b" /></a></td>
<td>show warning when a TS Config is not found during migrations</td>
</tr>
</tbody>
</table>
<h3><code>@​angular/cli</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="eda96def48"><img
src="https://img.shields.io/badge/eda96def4-fix-green" alt="fix -
eda96def4" /></a></td>
<td>use global version of the CLI when running <code>ng new</code></td>
</tr>
</tbody>
</table>
<h3><code>@​angular-devkit/build-angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="2af32fd3a9"><img
src="https://img.shields.io/badge/2af32fd3a-fix-green" alt="fix -
2af32fd3a" /></a></td>
<td>hide loader paths in webpack warnings</td>
</tr>
<tr>
<td><a
href="19f5cc746e"><img
src="https://img.shields.io/badge/19f5cc746-fix-green" alt="fix -
19f5cc746" /></a></td>
<td>improve package deep import Sass index resolution in esbuild
plugin</td>
</tr>
<tr>
<td><a
href="2220a907da"><img
src="https://img.shields.io/badge/2220a907d-fix-green" alt="fix -
2220a907d" /></a></td>
<td>use url function lexer to rebase Sass URLs</td>
</tr>
</tbody>
</table>
<h2>Special Thanks</h2>
<p>Alan Agius, Charles Lyding, Doug Parker, Joey Perrott and Piotr
Wysocki</p>
<h2>v15.0.0</h2>
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h1>15.0.0 (2022-11-16)</h1>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/angular/angular-cli/blob/main/CHANGELOG.md"><code>@​angular-devkit/schematics</code>'s
changelog</a>.</em></p>
<blockquote>
<h1>15.0.3 (2022-12-07)</h1>
<h3><code>@​angular-devkit/build-angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="3d9971edb0">3d9971edb</a></td>
<td>fix</td>
<td>default preserve symlinks to Node.js value for esbuild</td>
</tr>
<tr>
<td><a
href="24f4b51d22">24f4b51d2</a></td>
<td>fix</td>
<td>downlevel class fields with Safari &lt;= v15 for esbuild</td>
</tr>
<tr>
<td><a
href="45afc42db8">45afc42db</a></td>
<td>fix</td>
<td>downlevel class properties when targeting Safari &lt;=v15</td>
</tr>
<tr>
<td><a
href="e6461badf7">e6461badf</a></td>
<td>fix</td>
<td>prevent optimization adding unsupported ECMASCript features</td>
</tr>
</tbody>
</table>
<h2>Special Thanks</h2>
<p>Charles Lyding, Dominic Elm and Paul Gschwendtner</p>
<!-- raw HTML omitted -->
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<h1>15.1.0-next.1 (2022-11-30)</h1>
<h3><code>@​schematics/angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="9299dea649">9299dea64</a></td>
<td>feat</td>
<td>generate functional interceptors</td>
</tr>
<tr>
<td><a
href="9b6d190f4a">9b6d190f4</a></td>
<td>fix</td>
<td>remove EnvironmentInjector import in functional guard spec</td>
</tr>
<tr>
<td><a
href="b11d3f6442">b11d3f644</a></td>
<td>fix</td>
<td>use proper variable in functional guard spec</td>
</tr>
<tr>
<td><a
href="451975f765">451975f76</a></td>
<td>fix</td>
<td>use proper variable in resolver functional spec</td>
</tr>
</tbody>
</table>
<h3><code>@​angular-devkit/build-angular</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="012393d379">012393d37</a></td>
<td>fix</td>
<td>correctly set Sass quietDeps and verbose options</td>
</tr>
</tbody>
</table>
<h3><code>@​ngtools/webpack</code></h3>
<table>
<thead>
<tr>
<th>Commit</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a
href="856720b913">856720b91</a></td>
<td>fix</td>
<td>elide unused type references</td>
</tr>
</tbody>
</table>
<h2>Special Thanks</h2>
<p>Alan Agius, Andrew Scott, Cédric Exbrayat, Jason Bedard and Juuso
Valkeejärvi</p>
<!-- raw HTML omitted -->
<p><!-- raw HTML omitted --><!-- raw HTML omitted --></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="eb2a73a351"><code>eb2a73a</code></a>
release: cut the v15.0.3 release</li>
<li><a
href="3d9971edb0"><code>3d9971e</code></a>
fix(<code>@​angular-devkit/build-angular</code>): default preserve
symlinks to Node.js valu...</li>
<li><a
href="24f4b51d22"><code>24f4b51</code></a>
fix(<code>@​angular-devkit/build-angular</code>): downlevel class fields
with Safari &lt;= v15...</li>
<li><a
href="20e0742154"><code>20e0742</code></a>
refactor(<code>@​angular-devkit/build-angular</code>): update
browserslist conversion to la...</li>
<li><a
href="18f31009c1"><code>18f3100</code></a>
refactor(<code>@​angular-devkit/build-angular</code>): convert into a
function to give mor...</li>
<li><a
href="45afc42db8"><code>45afc42</code></a>
fix(<code>@​angular-devkit/build-angular</code>): downlevel class
properties when targeting...</li>
<li><a
href="e6461badf7"><code>e6461ba</code></a>
fix(<code>@​angular-devkit/build-angular</code>): prevent optimization
adding unsupported E...</li>
<li><a
href="d77416f8cc"><code>d77416f</code></a>
release: cut the v15.0.2 release</li>
<li><a
href="0a543eaa2d"><code>0a543ea</code></a>
Revert &quot;docs: remove <code>@latest</code> reference from <code>npm
init</code> command&quot;</li>
<li><a
href="d9cc4b0289"><code>d9cc4b0</code></a>
fix(<code>@​ngtools/webpack</code>): elide unused type references</li>
<li>Additional commits viewable in <a
href="https://github.com/angular/angular-cli/compare/14.2.8...15.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@angular-devkit/schematics&package-manager=npm_and_yarn&previous-version=14.2.8&new-version=15.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-14 14:22:13 +01:00
.github chore: Revert Dependabot config (#9411) 2022-12-14 09:58:57 +01:00
.husky chore: Improve CI (#8601) 2022-07-01 15:03:12 +02:00
.vscode chore(ng-schematics): Use WireIt for builds and tests (#9356) 2022-12-05 10:35:31 +01:00
docker feat!: use ~/.cache/puppeteer for browser downloads (#9095) 2022-10-11 11:20:45 +00:00
docs docs: mention how to disable timeout for page.pdf() (#9167) 2022-12-12 12:12:18 +00:00
examples docs: fix cross-browser.js example (#9291) 2022-11-17 13:26:08 +01:00
packages chore(deps): Bump @angular-devkit/schematics from 14.2.8 to 15.0.3 (#9413) 2022-12-14 14:22:13 +01:00
test fix: improve a11y snapshot handling if the tree is not correct (#9405) 2022-12-13 08:31:26 +00:00
test-d fix(puppeteer-core): avoid type instantiation errors (#9370) 2022-12-06 19:21:08 +01:00
tools feat(chromium): roll to Chromium 109.0.5412.0 (r1069273) (#9364) 2022-12-07 14:54:00 +01:00
website docs: various doc improvements (#9396) 2022-12-09 13:57:39 +01:00
.editorconfig EditorConfig: 2 space indent (#195) 2017-08-03 09:50:08 -07:00
.eslintignore feat!: use ~/.cache/puppeteer for browser downloads (#9095) 2022-10-11 11:20:45 +00:00
.eslintplugin.js chore: add custom rule for formatting comments (#8777) 2022-08-12 14:15:26 +02:00
.eslintrc.js chore: rename vendor to third_party (#9021) 2022-09-28 15:23:37 +02:00
.eslintrc.types.cjs fix: remove unused imports (#8613) 2022-07-01 16:00:03 +02:00
.gitattributes chore(git): Fix line endings in text files (#4320) 2019-04-22 09:03:42 -07:00
.gitignore chore(ng-schematics): Use WireIt for builds and tests (#9356) 2022-12-05 10:35:31 +01:00
.mocharc.cjs chore: support WebDriver BiDi browser instances (#8932) 2022-09-15 02:15:15 +02:00
.npmrc fix: move CI npm config out of .npmrc (#6901) 2021-02-17 18:52:22 +01:00
.prettierignore chore(ng-schematics): Use WireIt for builds and tests (#9356) 2022-12-05 10:35:31 +01:00
.prettierrc.cjs docs: improve docs (#9179) 2022-10-28 08:49:28 +02:00
.release-please-manifest.json chore: release main (#9322) 2022-12-07 19:35:29 +01:00
commitlint.config.js chore: update commitlint.config.js (#9064) 2022-10-06 09:40:39 +02:00
LICENSE chore: use https URL for license info (#6279) 2020-08-10 10:35:07 +02:00
package-lock.json chore(deps): Bump @angular-devkit/schematics from 14.2.8 to 15.0.3 (#9413) 2022-12-14 14:22:13 +01:00
package.json chore: upgrade mitt (#9340) 2022-11-29 19:50:58 +00:00
README.md docs: improve docs (#9179) 2022-10-28 08:49:28 +02:00
release-please-config.json chore: update latest release sha (#9311) 2022-11-23 13:07:39 +01:00
tsconfig.base.json feat: separate puppeteer and puppeteer-core (#9023) 2022-10-05 14:17:03 +02:00
versions.js chore: release main (#9322) 2022-12-07 19:35:29 +01:00

Puppeteer

Build status npm puppeteer package

Guides | API | FAQ | Contributing | Troubleshooting

Puppeteer is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol. Puppeteer runs in headless 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 of your site to help diagnose performance issues.
  • Test Chrome Extensions.

Getting Started

Installation

To use Puppeteer in your project, run:

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 with Puppeteer. For a version of Puppeteer without installation, see puppeteer-core.

Configuration

Puppeteer uses several defaults that can be customized through configuration files.

For example, to change the default cache directory Puppeteer uses to install browsers, you can add a .puppeteerrc.cjs (or puppeteer.config.cjs) at the root of your application with the contents

const {join} = require('path');

/**
 * @type {import("puppeteer").Configuration}
 */
module.exports = {
  // Changes the cache location for Puppeteer.
  cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};

After adding the configuration file, you will need to remove and reinstall puppeteer for it to take effect.

See the configuration guide for more information.

puppeteer-core

Every release since v1.7.0 we publish two packages:

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 automates several workflows using reasonable defaults that can be customized.

puppeteer-core is a library to help drive anything that supports DevTools protocol. Being a library, puppeteer-core is fully driven through its programmatic interface implying no defaults are assumed and puppeteer-core will not download Chromium when installed.

You should use puppeteer-core if you are connecting to a remote browser or managing browsers yourself. If you are managing browsers yourself, you will need to call puppeteer.launch with an an explicit executablePath (or channel if it's installed in a standard location).

When using puppeteer-core, remember to change the import:

import puppeteer from 'puppeteer-core';

Usage

Puppeteer follows the latest maintenance LTS version of Node.

Puppeteer will be familiar to people using other browser testing frameworks. You launch/connect a browser, create some pages, and then manipulate them with Puppeteer's API.

For more in-depth usage, check our guides and examples.

Example

The following example searches developers.google.com/web for articles tagged "Headless Chrome" and scrape results from the results page.

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. To launch a full version of Chromium, set the headless option when launching a browser:

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:

const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});

You can also use Puppeteer with Firefox Nightly (experimental support). See Puppeteer.launch for more information.

See this article for a description of the differences between Chromium and Chrome. This article describes some differences for Linux users.

3. Creates a fresh user profile

Puppeteer creates its own browser user profile which it cleans up on every run.

Using Docker

See our Docker guide.

Using Chrome Extensions

See our Chrome extensions guide.

Resources

Contributing

Check out our contributing guide to get an overview of Puppeteer development.

FAQ

Our FAQ has migrated to our site.