3 [![build](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml)
4 [![npm puppeteer package](https://img.shields.io/npm/v/puppeteer.svg)](https://npmjs.org/package/puppeteer)
6 <img src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png" height="200" align="right"/>
8 > Puppeteer is a JavaScript library which provides a high-level API to control
9 > Chrome or Firefox over the
10 > [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) or [WebDriver BiDi](https://pptr.dev/webdriver-bidi).
11 > Puppeteer runs in the headless (no visible UI) by default
13 ## [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)
18 npm i puppeteer # Downloads compatible Chrome during installation.
19 npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.
25 import puppeteer from 'puppeteer';
26 // Or import puppeteer from 'puppeteer-core';
28 // Launch the browser and open a new blank page
29 const browser = await puppeteer.launch();
30 const page = await browser.newPage();
32 // Navigate the page to a URL.
33 await page.goto('https://developer.chrome.com/');
36 await page.setViewport({width: 1080, height: 1024});
38 // Type into search box.
39 await page.locator('.devsite-search-field').fill('automate beyond recorder');
41 // Wait and click on first result.
42 await page.locator('.devsite-result-item-link').click();
44 // Locate the full title with a unique string.
45 const textSelector = await page
46 .locator('text/Customize and automate')
48 const fullTitle = await textSelector?.evaluate(el => el.textContent);
50 // Print the full title.
51 console.log('The title of this blog post is "%s".', fullTitle);
53 await browser.close();