<ahref="https://npmjs.org/package/puppeteer"target="_blank"rel="noopener noreferrer"><imgloading="lazy"src="https://img.shields.io/npm/v/puppeteer.svg"alt="npm puppeteer package"class="img_ev3q"></a></p><imgloading="lazy"src="https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png"height="200"align="right"class="img_ev3q"><h4class="anchor anchorWithStickyNavbar_LWe7"id="guides--api--faq--contributing--troubleshooting"><ahref="https://pptr.dev/guides"target="_blank"rel="noopener noreferrer">Guides</a> | <ahref="https://pptr.dev/api"target="_blank"rel="noopener noreferrer">API</a> | <ahref="https://pptr.dev/faq"target="_blank"rel="noopener noreferrer">FAQ</a> | <ahref="https://pptr.dev/contributing"target="_blank"rel="noopener noreferrer">Contributing</a> | <ahref="https://pptr.dev/troubleshooting"target="_blank"rel="noopener noreferrer">Troubleshooting</a><aclass="hash-link"href="#guides--api--faq--contributing--troubleshooting"title="Direct link to heading"></a></h4><blockquote><p>Puppeteer is a Node.js library which provides a high-level API to control
mode by default, but can be configured to run in full (non-headless)
Chrome/Chromium.</p></blockquote><h4class="anchor anchorWithStickyNavbar_LWe7"id="what-can-i-do">What can I do?<aclass="hash-link"href="#what-can-i-do"title="Direct link to heading"></a></h4><p>Most things that you can do manually in the browser can be done using Puppeteer!
Here are a few examples to get you started:</p><ul><li>Generate screenshots and PDFs of pages.</li><li>Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e.
"SSR" (Server-Side Rendering)).</li><li>Automate form submission, UI testing, keyboard input, etc.</li><li>Create an automated testing environment using the latest JavaScript and
of your site to help diagnose performance issues.</li><li>Test Chrome Extensions.</li></ul><h2class="anchor anchorWithStickyNavbar_LWe7"id="getting-started">Getting Started<aclass="hash-link"href="#getting-started"title="Direct link to heading"></a></h2><h3class="anchor anchorWithStickyNavbar_LWe7"id="installation">Installation<aclass="hash-link"href="#installation"title="Direct link to heading"></a></h3><p>To use Puppeteer in your project, run:</p><divclass="language-bash codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#393A34"><spanclass="token function"style="color:#d73a49">npm</span><spanclass="token plain"> i puppeteer</span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token comment"style="color:#999988;font-style:italic"># or `yarn add puppeteer`</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token comment"style="color:#999988;font-style:italic"># or `pnpm i puppeteer`</span><br></span></code></pre><divclass="buttonGroup__atx"><buttontype="button"aria-label="Copy code to clipboard"title="Copy"class="clean-btn"><spanclass="copyButtonIcons_eSgA"aria-hidden="true"><svgclass="copyButtonIcon_y97N"viewBox="0 0 24 24"><pathd="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svgclass="copyButtonSuccessIcon_LjdS"viewBox="0 0 24 24"><pathd="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When you install Puppeteer, it automatically downloads a recent version of
Chromium (~170MB macOS, ~282MB Linux, ~280MB Windows) that is
<ahref="https://pptr.dev/faq#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy"target="_blank"rel="noopener noreferrer">guaranteed to work</a>
with Puppeteer. For a version of Puppeteer without installation, see
<ahref="#puppeteer-core"><code>puppeteer-core</code></a>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="configuring-puppeteer">Configuring Puppeteer<aclass="hash-link"href="#configuring-puppeteer"title="Direct link to heading"></a></h4><p>Puppeteer uses several defaults that can be customized through configuration
files.</p><p>For example, to change the default cache directory Puppeteer uses to install
browsers, you can add a <code>.puppeteerrc.cjs</code> (or <code>puppeteer.config.cjs</code>) at the
<code>puppeteer</code> for it to take effect.</p><p>See <ahref="https://pptr.dev/guides/configuring-puppeteer"target="_blank"rel="noopener noreferrer">Configuring
Puppeteer</a> for more information.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="puppeteer-core"><code>puppeteer-core</code><aclass="hash-link"href="#puppeteer-core"title="Direct link to heading"></a></h4><p>Every release since v1.7.0 we publish two packages:</p><ul><li><ahref="https://www.npmjs.com/package/puppeteer"target="_blank"rel="noopener noreferrer"><code>puppeteer</code></a></li><li><ahref="https://www.npmjs.com/package/puppeteer-core"target="_blank"rel="noopener noreferrer"><code>puppeteer-core</code></a></li></ul><p><code>puppeteer</code> is a <em>product</em> for browser automation. When installed, it downloads
end-user product, <code>puppeteer</code> automates several workflows using reasonable defaults <ahref="https://pptr.dev/guides/configuring-puppeteer"target="_blank"rel="noopener noreferrer">that can be customized</a>.</p><p><code>puppeteer-core</code> is a <em>library</em> to help drive anything that supports DevTools
protocol. Being a library, <code>puppeteer-core</code> is fully driven through its
programmatic interface implying no defaults are assumed and <code>puppeteer-core</code>
will not download Chromium when installed.</p><p>You should use <code>puppeteer-core</code> if you are <ahref="https://pptr.dev/api/puppeteer.puppeteer.connect"target="_blank"rel="noopener noreferrer">connecting to a remote
browser</a> or <ahref="https://pptr.dev/api/puppeteer.browserfetcher"target="_blank"rel="noopener noreferrer">managing browsers
a <ahref="https://pptr.dev/api/puppeteer.browser"target="_blank"rel="noopener noreferrer">browser</a>,
<ahref="https://pptr.dev/api/puppeteer.browser.newpage"target="_blank"rel="noopener noreferrer">create</a> some
<ahref="https://pptr.dev/api/puppeteer.page"target="_blank"rel="noopener noreferrer">pages</a>, and then manipulate them with
<ahref="https://pptr.dev/api"target="_blank"rel="noopener noreferrer">Puppeteer's API</a>.</p><p>For more in-depth usage, check our <ahref="https://pptr.dev/guides"target="_blank"rel="noopener noreferrer">guides</a> and
<ahref="https://github.com/puppeteer/puppeteer/tree/main/examples"target="_blank"rel="noopener noreferrer">examples</a>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="example">Example<aclass="hash-link"href="#example"title="Direct link to heading"></a></h4><p>The following example searches
<ahref="https://developers.google.com/web"target="_blank"rel="noopener noreferrer">developers.google.com/web</a> for articles
describes some differences for Linux users.</p><p><strong>3. Creates a fresh user profile</strong></p><p>Puppeteer creates its own browser user profile which it <strong>cleans up on every
run</strong>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="using-docker">Using Docker<aclass="hash-link"href="#using-docker"title="Direct link to heading"></a></h4><p>See our <ahref="https://pptr.dev/guides/docker"target="_blank"rel="noopener noreferrer">guide on using Docker</a>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="using-chrome-extensions">Using Chrome Extensions<aclass="hash-link"href="#using-chrome-extensions"title="Direct link to heading"></a></h4><p>See our
<ahref="https://pptr.dev/guides/chrome-extensions"target="_blank"rel="noopener noreferrer">guide on using Chrome extensions</a>.</p><h2class="anchor anchorWithStickyNavbar_LWe7"id="resources">Resources<aclass="hash-link"href="#resources"title="Direct link to heading"></a></h2><ul><li><ahref="https://pptr.dev/api"target="_blank"rel="noopener noreferrer">API Documentation</a></li><li><ahref="https://pptr.dev/guides"target="_blank"rel="noopener noreferrer">Guides</a></li><li><ahref="https://github.com/puppeteer/puppeteer/tree/main/examples"target="_blank"rel="noopener noreferrer">Examples</a></li><li><ahref="https://github.com/transitive-bullshit/awesome-puppeteer"target="_blank"rel="noopener noreferrer">Community list of Puppeteer resources</a></li></ul><h2class="anchor anchorWithStickyNavbar_LWe7"id="contributing">Contributing<aclass="hash-link"href="#contributing"title="Direct link to heading"></a></h2><p>Check out our <ahref="https://pptr.dev/contributing"target="_blank"rel="noopener noreferrer">contributing guide</a> to get an
overview of Puppeteer development.</p><h2class="anchor anchorWithStickyNavbar_LWe7"id="faq">FAQ<aclass="hash-link"href="#faq"title="Direct link to heading"></a></h2><p>Our <ahref="https://pptr.dev/faq"target="_blank"rel="noopener noreferrer">FAQ</a> has migrated to