gecko-dev/remote/test/puppeteer
2024-10-08 17:30:45 +00:00
..
.vscode Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
examples Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
packages Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
test Bug 1898158 - [bidi] Support url parameter in network.continueRequest r=webdriver-reviewers,Sasha 2024-10-08 17:30:45 +00:00
test-d Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
tools Bug 1912239 - [puppeteer] Remove -S parameter in Shebang from mocha-runner script because it's not supported in CI r=webdriver-reviewers,whimboo 2024-08-20 19:45:09 +00:00
.editorconfig
.eslintignore Bug 1907533 - [puppeteer] Sync vendored puppeteer to v22.13.0 r=webdriver-reviewers,Sasha 2024-07-15 10:24:51 +00:00
.eslintrc.js
.eslintrc.types.cjs
.mocharc.cjs
.npmrc
.nvmrc
.prettierignore
.prettierrc.cjs
.release-please-manifest.json Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
Herebyfile.mjs Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
json-mocha-reporter.js
LICENSE
moz.yaml Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
package-lock.json Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
package.json Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
puppeteer.config.cjs Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
README.md Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00
release-please-config.json Bug 1897183 - [puppeteer] Sync vendored puppeteer to v22.9.0. r=webdriver-reviewers,whimboo 2024-05-17 15:20:45 +00:00
SECURITY.md
tsconfig.base.json Bug 1907533 - [puppeteer] Sync vendored puppeteer to v22.13.0 r=webdriver-reviewers,Sasha 2024-07-15 10:24:51 +00:00
tsdoc.json
versions.json Bug 1912239 - [puppeteer] Sync vendored puppeteer to v23.1.0 r=webdriver-reviewers,whimboo 2024-08-20 19:45:08 +00:00

Puppeteer

build npm puppeteer package

Puppeteer is a JavaScript library which provides a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi. Puppeteer runs in the headless (no visible UI) by default

Get started | API | FAQ | Contributing | Troubleshooting

Installation

npm i puppeteer # Downloads compatible Chrome during installation.
npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.

Example

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();