<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/category/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><ahref="#guides--api--faq--contributing--troubleshooting"class="hash-link"aria-label="Direct link to guides--api--faq--contributing--troubleshooting"title="Direct link to guides--api--faq--contributing--troubleshooting"></a></h4><blockquote><p>Puppeteer is a Node.js library which provides a high-level API to control
Chrome/Chromium.</p></blockquote><h4class="anchor anchorWithStickyNavbar_LWe7"id="what-can-i-do">What can I do?<ahref="#what-can-i-do"class="hash-link"aria-label="Direct link to What can I do?"title="Direct link to What can I do?"></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><ahref="https://pptr.dev/guides/chrome-extensions"target="_blank"rel="noopener noreferrer">Test Chrome Extensions</a>.</li></ul><h2class="anchor anchorWithStickyNavbar_LWe7"id="getting-started">Getting Started<ahref="#getting-started"class="hash-link"aria-label="Direct link to Getting Started"title="Direct link to Getting Started"></a></h2><h3class="anchor anchorWithStickyNavbar_LWe7"id="installation">Installation<ahref="#installation"class="hash-link"aria-label="Direct link to Installation"title="Direct link to Installation"></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 using yarn</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token function"style="color:#d73a49">yarn</span><spanclass="token plain"></span><spanclass="token function"style="color:#d73a49">add</span><spanclass="token plain"> puppeteer</span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token comment"style="color:#999988;font-style:italic"># or using pnpm</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token function"style="color:#d73a49">pnpm</span><spanclass="token plain"> 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"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="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><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="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
<ahref="https://developer.chrome.com/blog/chrome-for-testing/"target="_blank"rel="noopener noreferrer">Chrome for Testing</a> (~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
<ahref="#puppeteer-core"><code>puppeteer-core</code></a>.</p><p>If used with TypeScript, the minimum supported TypeScript version is <code>4.7.4</code>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="configuration">Configuration<ahref="#configuration"class="hash-link"aria-label="Direct link to Configuration"title="Direct link to Configuration"></a></h4><p>Puppeteer uses several defaults that can be customized through configuration
<code>puppeteer</code> for it to take effect.</p><p>See the <ahref="https://pptr.dev/guides/configuration"target="_blank"rel="noopener noreferrer">configuration guide</a> for more
information.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="puppeteer-core"><code>puppeteer-core</code><ahref="#puppeteer-core"class="hash-link"aria-label="Direct link to puppeteer-core"title="Direct link to puppeteer-core"></a></h4><p>For 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/configuration"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
installed in a standard location).</p><p>When using <code>puppeteer-core</code>, remember to change the import:</p><divclass="language-ts codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#393A34"><spanclass="token keyword"style="color:#00009f">import</span><spanclass="token plain"> puppeteer </span><spanclass="token keyword"style="color:#00009f">from</span><spanclass="token plain"></span><spanclass="token string"style="color:#e3116c">'puppeteer-core'</span><spanclass="token punctuation"style="color:#393A34">;</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"><svgviewBox="0 0 24 24"class="copyButtonIcon_y97N"><pathfill="currentColor"d="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><svgviewBox="0 0 24 24"class="copyButtonSuccessIcon_LjdS"><pathfill="currentColor"d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3class="anchor anchorWithStickyNavbar_LWe7"id="usage">Usage<ahref="#usage"class="hash-link"aria-label="Direct link to Usage"title="Direct link to Usage"></a></h3><p>Puppeteer follows the latest
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<ahref="#example"class="hash-link"aria-label="Direct link to Example"title="Direct link to Example"></a></h4><p>The following example searches <ahref="https://developer.chrome.com/"target="_blank"rel="noopener noreferrer">developer.chrome.com</a> for blog posts with text "automate beyond recorder", click on the first result and print the full title of the blog post.</p><divclass="language-ts codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><divclass="codeBlockContent_biex"><pretabindex="0"class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#393A34"><spanclass="token keyword"style="color:#00009f">import</span><spanclass="token plain"> puppeteer </span><spanclass="token keyword"style="color:#00009f">from</span><spanclass="token plain"></span><spanclass="token string"style="color:#e3116c">'puppeteer'</span><spanclass="token punctuation"style="color:#393A34">;</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"style="display:inline-block"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token punctuation"style="color:#393A34">(</span><spanclass="token keyword"style="color:#00009f">async</span><spanclass="token plain"></span><spanclass="token punctuation"style="color:#393A34">(</span><spanclass="token punctuation"style="color:#393A34">)</span><spanclass="token plain"></span><spanclass="token operator"style="color:#393A34">=></span><spanclass="token plain"></span><spanclass="token punctuation"style="color:#393A34">{</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">// Launch the browser and open a new blank page</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token keyword"style="color:#00009f">const</span><spanclass="token plain"> browser </span><spanclass="token operator"style="color:#393A34">=</span><spanclass="token plain"></span><spanclass="token keyword"style="color:#00009f">await</span><spanclass="token plain"> puppeteer</span><spanclass="token punctuation"style="color:#393A34">.</span><spanclass="token function"style="color:#d73a49">launch</span><spanclass="token punctuation"style="color:#393A34">(</span><spanclass="token punctuation"style="color:#393A34">)</span><spanclass="token punctuation"style="color:#393A34">;</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token keyword"style="color:#00009f">const</span><spanclass="token plain"> page </span><spanclass="token operator"style="color:#393A34">=</span><spanclass="token plain"></span><spanclass="token keyword"style="color:#00009f">await</span><spanclass="token plain"> browser</span><spanclass="token punctuation"style="color:#393A34">.</span><spanclass="token function"style="color:#d73a49">newPage</span><spanclass="token punctuation"style="color:#393A34">(</span><spanclass="token punctuation"style="color:#393A34">)</span><spanclass="token punctuation"style="color:#393A34">;</span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"style="display:inline-block"></span><br></span><spanclass="token-line"style="color:#393A34"><spanclass="token plain"></span><spanclass="token comment"style="color:#999988;font-style:italic">// Navigate the page to a URL</span><spanclass="token plain"></span><br></span><sp
<ahref="https://pptr.dev/api/puppeteer.browserlaunchargumentoptions"target="_blank"rel="noopener noreferrer"><code>headless</code></a> to <code>false</code>
<ahref="https://pptr.dev/faq/#q-what-is-the-status-of-cross-browser-support"target="_blank"rel="noopener noreferrer">status of cross-browser support</a> for
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<ahref="#using-docker"class="hash-link"aria-label="Direct link to Using Docker"title="Direct link to Using Docker"></a></h4><p>See our <ahref="https://pptr.dev/guides/docker"target="_blank"rel="noopener noreferrer">Docker guide</a>.</p><h4class="anchor anchorWithStickyNavbar_LWe7"id="using-chrome-extensions">Using Chrome Extensions<ahref="#using-chrome-extensions"class="hash-link"aria-label="Direct link to Using Chrome Extensions"title="Direct link to Using Chrome Extensions"></a></h4><p>See our <ahref="https://pptr.dev/guides/chrome-extensions"target="_blank"rel="noopener noreferrer">Chrome extensions guide</a>.</p><h2class="anchor anchorWithStickyNavbar_LWe7"id="resources">Resources<ahref="#resources"class="hash-link"aria-label="Direct link to Resources"title="Direct link to Resources"></a></h2><ul><li><ahref="https://pptr.dev/api"target="_blank"rel="noopener noreferrer">API Documentation</a></li><li><ahref="https://pptr.dev/category/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<ahref="#contributing"class="hash-link"aria-label="Direct link to Contributing"title="Direct link to Contributing"></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<ahref="#faq"class="hash-link"aria-label="Direct link to FAQ"title="Direct link to FAQ"></a></h2><p>Our <ahref="https://pptr.dev/faq"target="_blank"rel="noopener noreferrer">FAQ</a> has migrated to