<titledata-rh="true">Browser 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.browser"><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="Browser class | Puppeteer"><metadata-rh="true"name="description"content="Browser represents a browser instance that is either:"><metadata-rh="true"property="og:description"content="Browser represents a browser instance that is either:"><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/next/api/puppeteer.browser"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.browser"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.browser"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><ahref="/next/api/puppeteer.browser">Browser</a> represents a browser instance that is either:</p>
<ul>
<li>connected to via <ahref="/next/api/puppeteer.puppeteer.connect">Puppeteer.connect()</a> or - launched by <ahref="/next/api/puppeteer.puppeteernode.launch">PuppeteerNode.launch()</a>.</li>
</ul>
<p><ahref="/next/api/puppeteer.browser">Browser</a><ahref="/next/api/puppeteer.eventemitter">emits</a> various events which are documented in the <ahref="/next/api/puppeteer.browserevent">BrowserEvent</a> enum.</p>
<h4class="anchor anchorWithStickyNavbar_LWe7"id="signature">Signature:<ahref="#signature"class="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"></a></h4>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="remarks">Remarks<ahref="#remarks"class="hash-link"aria-label="Direct link to Remarks"title="Direct link to Remarks"></a></h2>
<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>Browser</code> class.</p>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="example-1">Example 1<ahref="#example-1"class="hash-link"aria-label="Direct link to Example 1"title="Direct link to Example 1"></a></h2>
<p>Using a <ahref="/next/api/puppeteer.browser">Browser</a> to create a <ahref="/next/api/puppeteer.page">Page</a>:</p>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="example-2">Example 2<ahref="#example-2"class="hash-link"aria-label="Direct link to Example 2"title="Direct link to Example 2"></a></h2>
<p>Disconnecting from and reconnecting to a <ahref="/next/api/puppeteer.browser">Browser</a>:</p>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="properties">Properties<ahref="#properties"class="hash-link"aria-label="Direct link to Properties"title="Direct link to Properties"></a></h2>
<table><thead><tr><th>Property</th><th>Modifiers</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>connected</td><td><code>readonly</code></td><td>boolean</td><td>Whether Puppeteer is connected to this <ahref="/next/api/puppeteer.browser">browser</a>.</td></tr><tr><td>debugInfo</td><td><code>readonly</code></td><td><ahref="/next/api/puppeteer.debuginfo">DebugInfo</a></td><td>Get debug information from Puppeteer.</td></tr></tbody></table>
<h2class="anchor anchorWithStickyNavbar_LWe7"id="methods">Methods<ahref="#methods"class="hash-link"aria-label="Direct link to Methods"title="Direct link to Methods"></a></h2>
<table><thead><tr><th>Method</th><th>Modifiers</th><th>Description</th></tr></thead><tbody><tr><td><ahref="/next/api/puppeteer.browser.browsercontexts">browserContexts</a></td><td></td><td><p>Gets a list of open <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>.</p><p>In a newly-created <ahref="/next/api/puppeteer.browser">browser</a>, this will return a single instance of <ahref="/next/api/puppeteer.browsercontext">BrowserContext</a>.</p></td></tr><tr><td><ahref="/next/api/puppeteer.browser.close">close</a></td><td></td><td>Closes this <ahref="/next/api/puppeteer.browser">browser</a> and all associated <ahref="/next/api/puppeteer.page">pages</a>.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.createincognitobrowsercontext">createIncognitoBrowserContext</a></td><td></td><td><p>Creates a new incognito <ahref="/next/api/puppeteer.browsercontext">browser context</a>.</p><p>This won't share cookies/cache with other <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>.</p></td></tr><tr><td><ahref="/next/api/puppeteer.browser.defaultbrowsercontext">defaultBrowserContext</a></td><td></td><td>Gets the default <ahref="/next/api/puppeteer.browsercontext">browser context</a>.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.disconnect">disconnect</a></td><td></td><td>Disconnects Puppeteer from this <ahref="/next/api/puppeteer.browser">browser</a>, but leaves the process running.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.isconnected">isConnected</a></td><td></td><td>Whether Puppeteer is connected to this <ahref="/next/api/puppeteer.browser">browser</a>.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.newpage">newPage</a></td><td></td><td>Creates a new <ahref="/next/api/puppeteer.page">page</a> in the <ahref="/next/api/puppeteer.browser.defaultbrowsercontext">default browser context</a>.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.pages">pages</a></td><td></td><td><p>Gets a list of all open <ahref="/next/api/puppeteer.page">pages</a> inside this <ahref="/next/api/puppeteer.browser">Browser</a>.</p><p>If there ar multiple <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>, this returns all <ahref="/next/api/puppeteer.page">pages</a> in all <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>.</p></td></tr><tr><td><ahref="/next/api/puppeteer.browser.process">process</a></td><td></td><td>Gets the associated <ahref="https://nodejs.org/api/child_process.html#class-childprocess"target="_blank"rel="noopener noreferrer">ChildProcess</a>.</td></tr><tr><td><ahref="/next/api/puppeteer.browser.target">target</a></td><td></td><td>Gets the <ahref="/next/api/puppeteer.target">target</a> associated with the <ahref="/next/api/puppeteer.browser.defaultbrowsercontext">default browser context</a>).</td></tr><tr><td><ahref="/next/api/puppeteer.browser.targets">targets</a></td><td></td><td><p>Gets all active <ahref="/next/api/puppeteer.target">targets</a>.</p><p>In case of multiple <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>, this returns all <ahref="/next/api/puppeteer.target">targets</a> in all <ahref="/next/api/puppeteer.browsercontext">browser contexts</a>.</p></td></tr><tr><td><ahref="/next/api/puppeteer.browser.useragent">userAgent</a></td><td></td><td><p>Gets this <ahref="/next/api/puppeteer.browser">browser's</a> original user agent.</p><p><ahref="/next/api/puppeteer.page">Pages</a> can override the user agent with <ahref="/next/api/puppeteer.page.setuseragent">Page.setUserAgent()</a>.</p></td></tr><tr><td><ahref="/next/api/puppeteer.browser.version">version</a></td><td></td><td><p>Gets a string representing this <ahref="/next/api/puppeteer.browser">browser's</a> name and version.</p><p>For headless browser, this is similar to <code>"HeadlessChrome/61.0.3153.0"</code>. For non-headless or new-headless, this is similar to <code>"Chrome/61.0.3153.0"</code>. For Firefox, it is similar to <code>"Firefox/116.0a1"</code>.</p><p>The format of <ahref="/next/ap