Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of BrowserContext.
Closes browser with all the pages (if any were opened). The browser object itself is considered to be disposed and can not be used anymore.
Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
Returns the default browser context. The default browser context can not be closed.
Disconnects Puppeteer from the browser, but leaves the Chromium process running.
After calling disconnect
, the browser object is considered disposed and cannot be used anymore.
Indicates that the browser is connected.
Promise which resolves to a new Page object.
Adds the listener function to the end of the listeners array for the event named eventName
.
No checks are made to see if the listener has already been added. Multiple calls passing the same combination of
eventName
and listener will result in the listener being added, and called, multiple times.
The callback function.
Adds a one time listener function for the event named eventName
.
The next time eventName
is triggered, this listener is removed and then invoked.
The callback function.
Promise which resolves to an array of all open pages.
Spawned browser process. Returns null
if the browser instance was created with puppeteer.connect
method
A target associated with the browser.
Promise which resolves to an array of all active targets.
Promise which resolves to the browser's original user agent.
NOTE Pages can override browser user agent with page.setUserAgent
.
For headless Chromium, this is similar to HeadlessChrome/61.0.3153.0. For non-headless, this is similar to Chrome/61.0.3153.0.
Browser websocket endpoint which can be used as an argument to puppeteer.connect. The format is ws://${host}:${port}/devtools/browser/
Generated using TypeDoc
A Browser is created when Puppeteer connects to a Chromium instance, either through puppeteer.launch or puppeteer.connect.