<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><p>Property</p></th><th><p>Modifiers</p></th><th><p>Type</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><p>connected</p></td><td><p><code>readonly</code></p></td><td><p>boolean</p></td><td><p>Whether Puppeteer is connected to this <ahref="/next/api/puppeteer.browser">browser</a>.</p></td></tr><tr><td><p>debugInfo</p></td><td><p><code>readonly</code></p></td><td><p><ahref="/next/api/puppeteer.debuginfo">DebugInfo</a></p></td><td><p>Get debug information from Puppeteer.</p></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><p>Method</p></th><th><p>Modifiers</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><p><ahref="/next/api/puppeteer.browser.browsercontexts">browserContexts()</a></p></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><p><ahref="/next/api/puppeteer.browser.close">close()</a></p></td><td></td><td><p>Closes this <ahref="/next/api/puppeteer.browser">browser</a> and all associated <ahref="/next/api/puppeteer.page">pages</a>.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.createbrowsercontext">createBrowserContext(options)</a></p></td><td></td><td><p>Creates a new <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><p><ahref="/next/api/puppeteer.browser.defaultbrowsercontext">defaultBrowserContext()</a></p></td><td></td><td><p>Gets the default <ahref="/next/api/puppeteer.browsercontext">browser context</a>.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.disconnect">disconnect()</a></p></td><td></td><td><p>Disconnects Puppeteer from this <ahref="/next/api/puppeteer.browser">browser</a>, but leaves the process running.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.isconnected">isConnected()</a></p></td><td><p><code>deprecated</code></p></td><td><p>Whether Puppeteer is connected to this <ahref="/next/api/puppeteer.browser">browser</a>.</p><p><strong>Deprecated:</strong></p><p>Use <ahref="/next/api/puppeteer.browser">Browser.connected</a>.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.newpage">newPage()</a></p></td><td></td><td><p>Creates a new <ahref="/next/api/puppeteer.page">page</a> in the <ahref="/next/api/puppeteer.browser.defaultbrowsercontext">default browser context</a>.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.pages">pages()</a></p></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><p><ahref="/next/api/puppeteer.browser.process">process()</a></p></td><td></td><td><p>Gets the associated <ahref="https://nodejs.org/api/child_process.html#class-childprocess"target="_blank"rel="noopener noreferrer">ChildProcess</a>.</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.target">target()</a></p></td><td></td><td><p>Gets the <ahref="/next/api/puppeteer.target">target</a> associated with the <ahref="/next/api/puppeteer.browser.defaultbrowsercontext">default browser context</a>).</p></td></tr><tr><td><p><ahref="/next/api/puppeteer.browser.targets">targets()</a></p></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><p><ahref="/next/api/puppeteer.browser.useragent">userAgent()</a></p></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><p><ahref="/next/api/puppeteer.browser.version">version()</a></p></td><td></td><td><p>Gets a string representing this <ahref="/next/api/puppeteer.browser">browser's</a> name and version.</p><p