<titledata-rh="true">PuppeteerNode class | Puppeteer</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://pptr.dev/next/api/puppeteer.puppeteernode"><metadata-rh="true"property="og:locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="docsearch:counter"content="3"><metadata-rh="true"property="og:title"content="PuppeteerNode class | Puppeteer"><metadata-rh="true"name="description"content="Extends the main Puppeteer class with Node specific behaviour for fetching and downloading browsers."><metadata-rh="true"property="og:description"content="Extends the main Puppeteer class with Node specific behaviour for fetching and downloading browsers."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/next/api/puppeteer.puppeteernode"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.puppeteernode"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.puppeteernode"hreflang="x-default"><linkdata-rh="true"rel="preconnect"href="https://DVKY664LG7-dsn.algolia.net"crossorigin="anonymous"><linkrel="search"type="application/opensearchdescription+xml"title="Puppeteer"href="/opensearch.xml">
<p>Extends the main <ahref="/next/api/puppeteer.puppeteer">Puppeteer</a> class with Node specific behaviour for fetching and downloading browsers.</p>
<p>If you're using Puppeteer in a Node environment, this is the class you'll get when you run <code>require('puppeteer')</code> (or the equivalent ES <code>import</code>).</p>
<h4class="anchor anchorWithStickyNavbar_FNw8"id="signature">Signature:<aclass="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"href="/next/api/puppeteer.puppeteernode#signature"></a></h4>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="remarks">Remarks<aclass="hash-link"aria-label="Direct link to Remarks"title="Direct link to Remarks"href="/next/api/puppeteer.puppeteernode#remarks"></a></h2>
<p>The most common method to use is <ahref="/next/api/puppeteer.puppeteernode.launch">launch</a>, which is used to launch and connect to a new browser instance.</p>
<p>See <ahref="/next/api/puppeteer.puppeteer">the main Puppeteer class</a> for methods common to all environments, such as <ahref="/next/api/puppeteer.puppeteer.connect">Puppeteer.connect()</a>.</p>
<p>The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the <code>PuppeteerNode</code> class.</p>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="example">Example<aclass="hash-link"aria-label="Direct link to Example"title="Direct link to Example"href="/next/api/puppeteer.puppeteernode#example"></a></h2>
<p>Once you have created a <code>page</code> you have access to a large API to interact with the page, navigate, or find certain elements in that page. The <ahref="/next/api/puppeteer.page">`page` documentation</a> lists all the available methods.</p>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="properties">Properties<aclass="hash-link"aria-label="Direct link to Properties"title="Direct link to Properties"href="/next/api/puppeteer.puppeteernode#properties"></a></h2>
<table><thead><tr><th><p>Property</p></th><th><p>Modifiers</p></th><th><p>Type</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><spanid="defaultproduct">defaultProduct</span></td><td><p><code>readonly</code></p></td><td><p><ahref="/next/api/puppeteer.product">Product</a></p></td><td><p>The name of the browser that will be launched by default. For <code>puppeteer</code>, this is influenced by your configuration. Otherwise, it's <code>chrome</code>.</p></td></tr><tr><td><spanid="lastlaunchedproduct">lastLaunchedProduct</span></td><td><p><code>readonly</code></p></td><td><p><ahref="/next/api/puppeteer.product">Product</a></p></td><td><p>The name of the browser that was last launched.</p></td></tr><tr><td><spanid="product">product</span></td><td><p><code>readonly, deprecated</code></p></td><td><p>string</p></td><td><p><strong>Deprecated:</strong></p><p>Do not use as this field as it does not take into account multiple browsers of different types. Use <ahref="/next/api/puppeteer.puppeteernode#defaultproduct">defaultProduct</a> or <ahref="/next/api/puppeteer.puppeteernode#lastlaunchedproduct">lastLaunchedProduct</a>.</p></td></tr></tbody></table>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="methods">Methods<aclass="hash-link"aria-label="Direct link to Methods"title="Direct link to Methods"href="/next/api/puppeteer.puppeteernode#methods"></a></h2>
<table><thead><tr><th><p>Method</p></th><th><p>Modifiers</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><spanid="connect"><ahref="/next/api/puppeteer.puppeteernode.connect">connect(options)</a></span></td><td></td><td><p>This method attaches Puppeteer to an existing browser instance.</p></td></tr><tr><td><spanid="defaultargs"><ahref="/next/api/puppeteer.puppeteernode.defaultargs">defaultArgs(options)</a></span></td><td></td><td></td></tr><tr><td><spanid="executablepath"><ahref="/next/api/puppeteer.puppeteernode.executablepath">executablePath(channel)</a></span></td><td></td><td><p>The default executable path.</p></td></tr><tr><td><spanid="launch"><ahref="/next/api/puppeteer.puppeteernode.launch">launch(options)</a></span></td><td></td><td><p>Launches a browser instance with given arguments and options when specified.</p><p>When using with <code>puppeteer-core</code>, <ahref="/next/api/puppeteer.launchoptions#executablepath">options.executablePath</a> or <ahref="/next/api/puppeteer.launchoptions#channel">options.channel</a> must be provided.</p><p><strong>Remarks:</strong></p><p>Puppeteer can also be used to control the Chrome browser, but it works best with the version of Chrome for Testing downloaded by default. There is no guarantee it will work with any other version. If Google Chrome (rather than Chrome for Testing) is preferred, a <ahref="https://www.google.com/chrome/browser/canary.html"target="_blank"rel="noopener noreferrer">Chrome Canary</a> or <ahref="https://www.chromium.org/getting-involved/dev-channel"target="_blank"rel="noopener noreferrer">Dev Channel</a> build is suggested. See <ahref="https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/"target="_blank"rel="noopener noreferrer">this article</a> for a description of the differences between Chromium and Chrome. <ahref="https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md"target="_blank"rel="noopener noreferrer">This article</a> describes some differences for Linux users. See <ahref="https://developer.chrome.com/blog/chrome-for-testing/"target="_blank"rel="noopener noreferrer">this doc</a> for the description of Chrome for Testing.</p></td></tr><tr><td><spanid="trimcache"><ahref="/next/api/puppeteer.puppeteernode.trimcache">trimCache()</a></span></td><td></td><td><p>Removes all non-current Firefox and Chrome binaries in the cache directory identified by the provided Puppeteer configuration. The current browser version is determined by resolving PUPPETEER_REVISIONS from Puppeteer unless <code>configuration.browserRevision</code> is provided.</p><p><strong>Remarks:</strong></p><p>Note that the method does not check if any other Puppeteer versions installed on the host that use the same cache directory require the non-current binaries.</p></td></tr></tbody></table></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--next"href="/next/api/puppeteer.puppeteernode.connect"><divclass="pagination-nav__sublabel">Next</div><divclass="pagination-nav__label">PuppeteerNode.connect</div></a></nav></div></div><divclass="col col--3"><divclass="tableOfContents_IS5x thin-scrollbar theme-doc-toc-desktop"><ulclass="table-of-contents table-of-contents__left-border"><li><aclass="table-of-contents__link toc-highlight"href="/next/api/puppeteer.puppeteernode#remarks">Remarks</a></li><li><aclass="table-of-contents__link toc-highlight"href="/next/api/puppeteer.puppeteernode#example">Example</a></li><li><aclass="table-of-contents__link toc-highlight"href="/next/api/puppeteer.puppeteernode#properties">Properties</a></li><li><aclass="table-of-contents__link toc-highlight"href="/next/api/puppeteer.puppeteernode#methods">Methods</a></li></ul></div></div></div></div></main></div></div></div><footerclass="footer footer--dark"><divclass="container container-fluid"><divclass="row footer__links"><divclass="col footer__col"><divclass="footer__title">Community</div><ulcl