Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/puppeteer/puppeteer
JavaScript API for Chrome and Firefox
https://github.com/puppeteer/puppeteer
automation chrome chromium developer-tools firefox headless-chrome node-module testing web
Last synced: 4 days ago
JSON representation
JavaScript API for Chrome and Firefox
- Host: GitHub
- URL: https://github.com/puppeteer/puppeteer
- Owner: puppeteer
- License: apache-2.0
- Created: 2017-05-09T22:16:13.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-12-04T10:27:20.000Z (9 days ago)
- Last Synced: 2024-12-04T10:38:16.300Z (9 days ago)
- Topics: automation, chrome, chromium, developer-tools, firefox, headless-chrome, node-module, testing, web
- Language: TypeScript
- Homepage: https://pptr.dev
- Size: 932 MB
- Stars: 89,015
- Watchers: 1,187
- Forks: 9,090
- Open Issues: 265
-
Metadata Files:
- Readme: README.md
- Contributing: docs/contributing.md
- License: LICENSE
- Security: SECURITY.md
- Support: docs/supported-browsers.md
Awesome Lists containing this project
- stars - puppeteer/puppeteer
- awesomeLibrary - puppeteer - Headless Chrome Node.js API (语言资源库 / typescript)
- my-awesome-list - puppeteer
- awesome-nodejs - puppeteer - Headless Chrome Node.js API. ![](https://img.shields.io/github/stars/puppeteer/puppeteer.svg?style=social&label=Star) (Repository / Automation & RPA)
- awesome-nodejs-cn - Puppeteer - **star:88803** Headless Chrome ![star > 2000][Awesome] (包 / 测试)
- awesome-ccamel - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- awesome-starred-test - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- awesome-trevor - Puppeteer - Headless Chrome Node.js API (Programming / JavaScript)
- gitcat - puppeteer
- awesome-nodejs - puppeteer - 无头 Chrome Node.js API。 ![](https://img.shields.io/github/stars/puppeteer/puppeteer.svg?style=social&label=Star) (GIT 仓库 / 自动化)
- awesome-repositories - puppeteer/puppeteer
- awesome-github-star - puppeteer
- awesome-naming - Puppeteer - A browser automation library. If the browser is the puppet, this is the puppeteer. (Tools, Applications, Libraries, Frameworks)
- awesome-starts - puppeteer/puppeteer - Headless Chrome Node.js API (TypeScript)
- awesome-pdf - Puppeteer - Node library for controlling Chrome. Can also generate PDFs. (Libraries / JavaScript)
- stars - puppeteer/puppeteer - Node.js API for Chrome (TypeScript)
- awesome-list - puppeteer
- awesome-nodejs - Puppeteer - Headless Chrome. (Packages / Testing)
- awesomeness - Puppeteer - Headless Chrome Node.js API. (🧪 Testing / ☸️ Kubernetes)
- StarryDivineSky - puppeteer/puppeteer
- awesome-nodejs - puppeteer - Headless Chrome Node.js API (Uncategorized / Uncategorized)
- awesome - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- awesome-hacking-lists - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- awesome-repositories - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- jimsghstars - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- AiTreasureBox - puppeteer/puppeteer - 12-07_89037_3](https://img.shields.io/github/stars/puppeteer/puppeteer.svg)|JavaScript API for Chrome and Firefox| (Repos)
- awesome - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- awesome - puppeteer/puppeteer - JavaScript API for Chrome and Firefox (TypeScript)
- stars - puppeteer
- stars - puppeteer
README
# Puppeteer
[![build](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml)
[![npm puppeteer package](https://img.shields.io/npm/v/puppeteer.svg)](https://npmjs.org/package/puppeteer)> Puppeteer is a JavaScript library which provides a high-level API to control
> Chrome or Firefox over the
> [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) or [WebDriver BiDi](https://pptr.dev/webdriver-bidi).
> Puppeteer runs in the headless (no visible UI) by default## [Get started](https://pptr.dev/docs) | [API](https://pptr.dev/api) | [FAQ](https://pptr.dev/faq) | [Contributing](https://pptr.dev/contributing) | [Troubleshooting](https://pptr.dev/troubleshooting)
## Installation
```bash npm2yarn
npm i puppeteer # Downloads compatible Chrome during installation.
npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.
```## Example
```ts
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';// Launch the browser and open a new blank page
const browser = await puppeteer.launch();
const page = await browser.newPage();// Navigate the page to a URL.
await page.goto('https://developer.chrome.com/');// Set screen size.
await page.setViewport({width: 1080, height: 1024});// Type into search box.
await page.locator('.devsite-search-field').fill('automate beyond recorder');// Wait and click on first result.
await page.locator('.devsite-result-item-link').click();// Locate the full title with a unique string.
const textSelector = await page
.locator('text/Customize and automate')
.waitHandle();
const fullTitle = await textSelector?.evaluate(el => el.textContent);// Print the full title.
console.log('The title of this blog post is "%s".', fullTitle);await browser.close();
```