Puppeteer Launch

puppeteer/api.md at main – GitHub

Interactive Documentation: API Translations: 中文|Chinese
Troubleshooting:
Releases per Chromium version:
Chromium 93. 0. 4577. 0 – Puppeteer v10. 2. 0
Chromium 92. 4512. 0
Chromium 91. 4469. 0 – Puppeteer v9. 0
Chromium 90. 4427. 0 – Puppeteer v8. 4403. 0 – Puppeteer v7. 0
Chromium 89. 4389. 0 – Puppeteer v6. 0
Chromium 88. 4298. 0 – Puppeteer v5. 5. 0
Chromium 87. 4272. 4. 0
Chromium 86. 4240. 3. 0
Chromium 85. 4182. 1
Chromium 84. 4147. 1. 0
Chromium 83. 4103. 0 – Puppeteer v3. 0
Chromium 81. 4044. 0
Chromium 80. 3987. 0 – Puppeteer v2. 0
Chromium 79. 3942. 0
Chromium 78. 3882. 0 – Puppeteer v1. 20. 0
Chromium 77. 3803. 19. 0
Chromium 76. 17. 0
Chromium 75. 3765. 15. 0
Chromium 74. 3723. 13. 0
Chromium 73. 3679. 12. 2
All releases
Table of Contents
Overview
puppeteer vs puppeteer-core
Environment Variables
Working with Chrome Extensions
class: Puppeteer
earCustomQueryHandlers()
nnect(options)
eateBrowserFetcher([options])
stomQueryHandlerNames()
faultArgs([options])
vices
puppeteer. executablePath()
([options])
tworkConditions
oduct
gisterCustomQueryHandler(name, queryHandler)
puppeteer. unregisterCustomQueryHandler(name)
class: BrowserFetcher
nDownload(revision)
wnload(revision[, progressCallback])
()
browserFetcher. localRevisions()
atform()
oduct()
(revision)
visionInfo(revision)
class: Browser
event: ‘disconnected’
event: ‘targetchanged’
event: ‘targetcreated’
event: ‘targetdestroyed’
owserContexts()
eateIncognitoBrowserContext([options])
faultBrowserContext()
browser. disconnect()
Connected()
wPage()
ocess()
s()
erAgent()
rsion()
browser. waitForTarget(predicate[, options])
Endpoint()
class: BrowserContext
owser()
earPermissionOverrides()
Incognito()
browserContext. overridePermissions(origin, permissions)
browserContext. waitForTarget(predicate[, options])
class: Page
event: ‘close’
event: ‘console’
event: ‘dialog’
event: ‘domcontentloaded’
event: ‘error’
event: ‘frameattached’
event: ‘framedetached’
event: ‘framenavigated’
event: ‘load’
event: ‘metrics’
event: ‘pageerror’
event: ‘popup’
event: ‘request’
event: ‘requestfailed’
event: ‘requestfinished’
event: ‘response’
event: ‘workercreated’
event: ‘workerdestroyed’
page. $(selector)
page. $$(selector)
page. $$eval(selector, pageFunction[,.. ])
page. $eval(selector, pageFunction[,.. $x(expression)
cessibility
dScriptTag(options)
dStyleTag(options)
thenticate(credentials)
ingToFront()
owserContext()
(selector[, options])
ntent()
okies([.. ])
verage
eatePDFStream([options])
leteCookie(okies)
page. emulate(options)
page. emulateCPUThrottling(factor)
page. emulateIdleState(overrides)
page. emulateMediaFeatures(features)
page. emulateMediaType(type)
page. emulateNetworkConditions(networkConditions)
page. emulateTimezone(timezoneId)
page. emulateVisionDeficiency(type)
page. evaluate(pageFunction[,.. evaluateHandle(pageFunction[,.. evaluateOnNewDocument(pageFunction[,.. exposeFunction(name, puppeteerFunction)
(selector)
page. goForward([options])
(url[, options])
Closed()
DragInterceptionEnabled()
JavaScriptEnabled()
yboard
inFrame()
trics()
page. queryObjects(prototypeHandle)
reenshot([options])
(selector,.. )
tBypassCSP(enabled)
tCacheEnabled([enabled])
tContent(html[, options])
tCookie(okies)
tDefaultNavigationTimeout(timeout)
tDefaultTimeout(timeout)
tDragInterception(enabled)
tExtraHTTPHeaders(headers)
tGeolocation(options)
tJavaScriptEnabled(enabled)
tOfflineMode(enabled)
tRequestInterception(value)
Cooperative Intercept Mode and Legacy Intercept Mode
Upgrading to Cooperative Mode for package maintainers
tUserAgent(userAgent[, userAgentMetadata])
tViewport(viewport)
uchscreen
acing
(selector, text[, options])
ewport()
page. waitFor(selectorOrFunctionOrTimeout[, options[,.. ]])
page. waitForFileChooser([options])
page. waitForFunction(pageFunction[, options[,.. waitForNavigation([options])
page. waitForNetworkIdle([options])
page. waitForRequest(urlOrPredicate[, options])
page. waitForResponse(urlOrPredicate[, options])
page. waitForSelector(selector[, options])
page. waitForTimeout(milliseconds)
page. waitForXPath(xpath[, options])
ers()
GeolocationOptions
WaitTimeoutOptions
class: WebWorker
webWorker. ])
webWorker. executionContext()
class: Accessibility
apshot([options])
class: Keyboard
(key[, options])
ndCharacter(char)
(text[, options])
(key)
class: Mouse
(x, y[, options])
(start, target)
mouse. dragAndDrop(start, target[, options])
mouse. dragEnter(target, data)
mouse. dragOver(target, data)
(target, data)
class: Touchscreen
(x, y)
class: Tracing
class: FileChooser
(filePaths)
Multiple()
class: Dialog
([promptText])
faultValue()
dialog. dismiss()
ssage()
class: ConsoleMessage
consoleMessage. location()
ackTrace()
class: Frame
frame. $(selector)
frame. $$(selector)
frame. ])
frame. $x(expression)
ildFrames()
frame. executionContext()
Detached()
rentFrame()
frame. ]])
frame. waitForNavigation([options])
frame. waitForSelector(selector[, options])
frame. waitForTimeout(milliseconds)
frame. waitForXPath(xpath[, options])
class: ExecutionContext
executionContext. ])
executionContext. queryObjects(prototypeHandle)
class: JSHandle
Element()
jsHandle. dispose()
jsHandle. ])
jsHandle. executionContext()
tProperties()
tProperty(propertyName)
jsHandle. jsonValue()
class: ElementHandle
elementHandle. $(selector)
elementHandle. $$(selector)
elementHandle. ])
elementHandle. $x(expression)
undingBox()
xModel()
ickablePoint([offset])
ntentFrame()
elementHandle. dispose()
(target)
elementHandle. dragAndDrop(target[, options])
elementHandle. dragEnter([data])
elementHandle. dragOver([data])
([data])
elementHandle. executionContext()
IntersectingViewport([options])
elementHandle. jsonValue()
(.. )
String()
elementHandle. uploadFile(lePaths)
class: HTTPRequest
([errorCode], [priority])
Request. abortErrorReason()
ntinue([overrides], [priority])
ntinueRequestOverrides()
Request. enqueueInterceptAction(pendingHandler)
ure()
nalizeInterceptions()
Request. headers()
itiator()
NavigationRequest()
Data()
directChain()
sourceType()
spond(response, [priority])
sponse()
sponseForRequest()
class: HTTPResponse
omCache()
omServiceWorker()
Response. headers()
moteAddress()
quest()
curityDetails()
atusText()
class: SecurityDetails
otocol()
bjectAlternativeNames()
bjectName()
lidFrom()
lidTo()
class: Target
eateCDPSession()
class: CDPSession
nnection()
(method[, ramArgs])
class: Coverage
artCSSCoverage([options])
artJSCoverage([options])
opCSSCoverage()
opJSCoverage()
class: TimeoutError
class: EventEmitter
dListener(event, handler)
(event, [eventData])
stenerCount(event)
(event, handler)
moveAllListeners([event])
moveListener(event, handler)
interface: CustomQueryHandler
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol.
The Puppeteer API is hierarchical and mirrors the browser structure.
NOTE On the following diagram, faded entities are not currently represented in Puppeteer.
Puppeteer communicates with the browser using DevTools Protocol.
Browser instance can own multiple browser contexts.
BrowserContext instance defines a browsing session and can own multiple pages.
Page has at least one frame: main frame. There might be other frames created by iframe or frame tags.
Frame has at least one execution context – the default execution context – where the frame’s JavaScript is executed. A Frame might have additional execution contexts that are associated with extensions.
Worker has a single execution context and facilitates interacting with WebWorkers.
(Diagram source: link)
Every release since v1. 7. 0 we publish two packages:
puppeteer
puppeteer-core
puppeteer is a product for browser automation. When installed, it downloads a version of
Chromium, which it then drives using puppeteer-core. Being an end-user product, puppeteer supports a bunch of convenient PUPPETEER_* env variables to tweak its behavior.
puppeteer-core is a library to help drive anything that supports DevTools protocol. puppeteer-core doesn’t download Chromium when installed. Being a library, puppeteer-core is fully driven
through its programmatic interface and disregards all the PUPPETEER_* env variables.
To sum up, the only differences between puppeteer-core and puppeteer are:
puppeteer-core doesn’t automatically download Chromium when installed.
puppeteer-core ignores all PUPPETEER_* env variables.
In most cases, you’ll be fine using the puppeteer package.
However, you should use puppeteer-core if:
you’re building another end-user product or library atop of DevTools protocol. For example, one might build a PDF generator using puppeteer-core and write a custom script that downloads headless_shell instead of Chromium to save disk space.
you’re bundling Puppeteer to use in Chrome Extension / browser with the DevTools protocol where downloading an additional Chromium binary is unnecessary.
you’re building a set of tools where puppeteer-core is one of the ingredients and you want to postpone script execution until Chromium is about to be used.
When using puppeteer-core, remember to change the include line:
const puppeteer = require(‘puppeteer-core’);
You will then need to call nnect([options]) or ([options]) with an explicit executablePath or channel option.
Puppeteer looks for certain environment variables to aid its operations.
If Puppeteer doesn’t find them in the environment during the installation step, a lowercased variant of these variables will be used from the npm config.
HTTP_PROXY, HTTPS_PROXY, NO_PROXY – defines HTTP proxy settings that are used to download and run the browser.
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD – do not download bundled Chromium during installation step.
PUPPETEER_TMP_DIR – defines the directory to be used by Puppeteer for creating temporary files. Defaults to ().
PUPPETEER_DOWNLOAD_HOST – overwrite URL prefix that is used to download Chromium. Note: this includes protocol and might even include path prefix. Defaults to PUPPETEER_DOWNLOAD_PATH – overwrite the path for the downloads folder. Defaults to /, where is Puppeteer’s package root.
PUPPETEER_CHROMIUM_REVISION – specify a certain version of Chromium you’d like Puppeteer to use. See ([options]) on how executable path is inferred. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
PUPPETEER_EXECUTABLE_PATH – specify an executable path to be used in See ([options]) on how the executable path is inferred. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
PUPPETEER_PRODUCT – specify which browser you’d like Puppeteer to use. Must be one of chrome or firefox. This can also be used during installation to fetch the recommended browser binary. Setting product programmatically in ([options]) supersedes this environment variable. The product is exposed in oduct
NOTE PUPPETEER_* env variables are not accounted for in the puppeteer-core package.
Puppeteer can be used for testing Chrome Extensions.
NOTE Extensions in Chrome / Chromium currently only work in non-headless mode.
The following is code for getting a handle to the background page of an extension whose source is located in. /my-extension:
const puppeteer = require(‘puppeteer’);
(async () => {
const pathToExtension = require(‘path’)(__dirname, ‘my-extension’);
const browser = await ({
headless: false,
args: [
`–disable-extensions-except=${pathToExtension}`,
`–load-extension=${pathToExtension}`, ], });
const targets = await s();
const backgroundPageTarget = (
(target) => () === ‘background_page’);
const backgroundPage = await ();
// Test the background page as you would any other page.
await ();})();
NOTE It is not yet possible to test extension popups or content scripts.
Puppeteer module provides a method to launch a Chromium instance.
The following is a typical example of using Puppeteer to drive automation:
const browser = await ();
const page = await wPage();
await (”);
// other actions…
Clears all registered handlers.
options
browserWSEndpoint a browser websocket endpoint to connect to.
browserURL a browser URL to connect to, in format ${host}:${port}. Use interchangeably with browserWSEndpoint to let Puppeteer fetch it from metadata endpoint.
ignoreHTTPSErrors Whether to ignore HTTPS errors during navigation. Defaults to false.
defaultViewport Sets a consistent viewport for each page. Defaults to an 800×600 viewport. null disables the default viewport.
width page width in pixels.
height page height in pixels.
deviceScaleFactor Specify device scale factor (can be thought of as DPR). Defaults to 1.
isMobile Whether the meta viewport tag is taken into account. Defaults to false.
hasTouch Specifies if viewport supports touch events. Defaults to false
isLandscape Specifies if viewport is in landscape mode. Defaults to false.
slowMo Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.
transport Experimental Specify a custom transport object for Puppeteer to use.
product Possible values are: chrome, firefox. Defaults to chrome.
targetFilter Use this function to decide if Puppeteer should connect to the given target. If a targetFilter is provided, Puppeteer only connects to targets for which targetFilter returns true. By default, Puppeteer connects to all available targets.
returns: >
This methods attaches Puppeteer to an existing browser instance.
host A download host to be used. Defaults to. If the product is firefox, this defaults to path A path for the downloads folder. Defaults to /, where is Puppeteer’s package root. If the product is firefox, this defaults to /
platform <"linux"|"mac"|"win32"|"win64"> string for the current platform. Possible values are: mac, win32, win64, linux. Defaults to the current platform.
product <"chrome"|"firefox"> string for the product to run. Possible values are: chrome, firefox. Defaults to chrome.
returns:
returns: A list with the names of all registered custom query handlers.
options Set of configurable options to set on the browser. Can have the following fields:
headless Whether to run browser in headless mode. Defaults to true unless the devtools option is true.
args > Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
userDataDir Path to a User Data Directory.
devtools Whether to auto-open a DevTools panel for each tab. If this option is true, the headless option will be set false.
debuggingPort Specify custom debugging port. Pass 0 to discover a random port. Defaults to 0.
returns: >
The default flags that Chromium will be launched with.
returns:
Returns a list of devices to be used with page. emulate(options). Actual list of
devices can be found in src/common/
const iPhone = vices[‘iPhone 6’];
await page. emulate(iPhone);
TimeoutError A class of TimeoutError.
Puppeteer methods might throw errors if they are unable to fulfill a request. For example, page. waitForSelector(selector[, options])
might fail if the selector doesn’t match any nodes during the given timeframe.
For certain types of errors Puppeteer uses specific error classes.
These classes are available via
An example of handling a timeout error:
try {
await page. waitForSelector(”);} catch (e) {
if (e instanceof) {
// Do something if this is a timeout. }}
NOTE The old way (Puppeteer versions <= v1. 14. 0) errors can be obtained with require('puppeteer/Errors'). returns: A path where Puppeteer expects to find the bundled browser. The browser binary might not be there if the download was skipped with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD.
NOTE puppeteer. executablePath() is affected by the PUPPETEER_EXECUTABLE_PATH and PUPPETEER_CHROMIUM_REVISION env variables. See Environment Variables for details.
product Which browser to launch. At this time, this is either chrome or firefox. See also PUPPETEER_PRODUCT.
channel When specified, Puppeteer will search for the locally installed release channel of Google Chrome and use it to launch. Available values are chrome, chrome-beta, chrome-canary, chrome-dev. When channel is specified, executablePath cannot be specified.
executablePath Path to a browser executable to run instead of the bundled Chromium. If executablePath is a relative path, then it is resolved relative to current working directory. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.
args > Additional arguments to pass to the browser instance. The list of Chromium flags can be found here, and here is the list of Firefox flags.
ignoreDefaultArgs > If true, then do not use faultArgs(). If an array is given, then filter out the given default arguments. Dangerous option; use with care. Defaults to false.
handleSIGINT Close the browser process on Ctrl-C. Defaults to true.
handleSIGTERM Close the browser process on SIGTERM. Defaults to true.
handleSIGHUP Close the browser process on SIGHUP. Defaults to true.
timeout Maximum time in milliseconds to wait for the browser instance to start. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
dumpio Whether to pipe the browser process stdout and stderr into and Defaults to false.
env Specify environment variables that will be visible to the browser. Defaults to
pipe Connects to the browser over a pipe instead of a WebSocket. Defaults to false.
extraPrefsFirefox Additional preferences that can be passed to Firefox (see PUPPETEER_PRODUCT)
waitForInitialPage Whether to wait for the initial page to be ready. Defaults to true.
returns: > Promise which resolves to browser instance.
You can use ignoreDefaultArgs to filter out –mute-audio from default arguments:
ignoreDefaultArgs: [‘–mute-audio’], });
NOTE Puppeteer can also be used to control the Chrome browser, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use executablePath or channel option with extreme caution.
If Google Chrome (rather than Chromium) is preferred, a Chrome Canary or Dev Channel build is suggested.
In ([options]) above, any mention of Chromium also applies to Chrome.
See this article for a description of the differences between Chromium and Chrome. This article describes some differences for Linux users.
Returns a list of network conditions to be used with page. emulateNetworkConditions(networkConditions). Actual list of
conditions can be found in src/common/
const slow3G = tworkConditions[‘Slow 3G’];
await page. emulateNetworkConditions(slow3G);
returns: returns the name of the browser that is under automation (“chrome” or “firefox”)
The product is set by the PUPPETEER_PRODUCT environment variable or the product option in ([options]) and defaults to chrome. Firefox support is experimental and requires to install Puppeteer via PUPPETEER_PRODUCT=firefox npm i puppeteer.
name The name that the custom query handler will be registered under.
queryHandler The custom query handler to register.
Registers a custom query handler. After registration, the handler can be used everywhere where a selector is expected by prepending the selection string with /. The name is only allowed to consist of lower and upper case Latin letters.
Example:
gisterCustomQueryHandler(‘getByClass’, {
queryOne: (element, selector) => {
return element. querySelector(`. ${selector}`);},
queryAll: (element, selector) => {
return element. querySelectorAll(`. ${selector}`);}, });
const aHandle = await page. $(‘getByClass/…’);
name The name of the query handler to unregister.
BrowserFetcher can download and manage different versions of Chromium and Firefox.
BrowserFetcher operates on revision strings that specify a precise version of Chromium, e. g. “533271”. Revision strings can be obtained from
In the Firefox case, BrowserFetcher downloads Firefox Nightly and operates on version numbers such as “75”.
An example of using BrowserFetcher to download a specific version of Chromium and running
Puppeteer against it:
const browserFetcher = eateBrowserFetcher();
const revisionInfo = await wnload(‘533271’);
executablePath: revisionInfo. executablePath, });
NOTE BrowserFetcher is not designed to work concurrently with other
instances of BrowserFetcher that share the same downloads directory.
revision a revision to check availability.
returns: > returns true if the revision could be downloaded from the host.
The method initiates a HEAD request to check if the revision is available.
revision a revision to download.
progressCallback A function that will be called with two arguments:
downloadedBytes how many bytes have been downloaded
totalBytes how large is the total download
returns: > Resolves with revision information when the revision is downloaded and extracted
revision the revision the info was created from
folderPath path to the extracted revision folder
executablePath path to the revision executable
url URL this revision can be downloaded from
local whether the revision is locally available on disk
The method initiates a GET request to download the revision from the host.
returns: The download host being used.
returns: >> A list of all revisions (for the current product) available locally on disk.
returns: One of mac, linux, win32 or win64.
returns: One of chrome or firefox.
revision a revision to remove for the current product. The method will throw if the revision has not been downloaded.
returns: Resolves when the revision has been removed.
revision a revision to get info for.
product one of chrome or firefox
NOTE Many BrowserFetcher methods, like remove and revisionInfo
are affected by the choice of product. See eateBrowserFetcher([options]).
extends: EventEmitter
A Browser is created when Puppeteer connects to a Chromium instance, either through or nnect.
An example of using a Browser to create a Page:
An example of disconnecting from and reconnecting to a Browser:
// Store the endpoint to be able to reconnect to Chromium
const browserWSEndpoint = Endpoint();
// Disconnect puppeteer from Chromium
browser. disconnect();
// Use the endpoint to reestablish a connection
const browser2 = await nnect({ browserWSEndpoint});
// Close Chromium
Emitted when Puppeteer gets disconnected from the Chromium instance. This might happen because of one of the following:
Chromium is closed or crashed
The browser. disconnect method was called

Emitted when the URL of a target changes.
NOTE This includes target changes in incognito browser contexts.
Emitted when a target is created, for example when a new page is opened by or wPage.
NOTE This includes target creations in incognito browser contexts.
Emitted when a target is destroyed, for example when a page is closed.
NOTE This includes target destructions in incognito browser contexts.
returns: >
Returns an array of all open browser contexts. In a newly created browser, this will return
a single instance of BrowserContext.
returns:
Closes Chromium and all of its pages (if any were opened). The Browser object itself is considered to be disposed and cannot be used anymore.
During the process of closing the browser, Puppeteer attempts to delete the temp folder created exclusively for this browser instance. If this fails (either because a file in the temp folder is locked by another process or because of insufficient permissions) an error is logged. This implies that: a) the folder and/or its content is not fully deleted; and b) the connection with the browser is not properly disposed (see browser. disconnect()).
options Set of configurable options to set on the browserContext. Can have the following fields:
proxyServer Optional proxy server with optional port to use for all requests. Username and password can be set in thenticate(credentials).
proxyBypassList Optional: Bypass the proxy for the given semi-colon-separated list of hosts.
returns: >
Creates a new incognito browser context. This won’t share cookies/cache with other browser contexts.
// Create a new incognito browser context.
const context = await eateIncognitoBrowserContext();
// Create a new page in a pristine context.
// Do stuff
await (”);})();
returns:
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.
returns:
Indicates that the browser is connected.
returns: >
Promise which resolves to a new Page object. The Page is created in a default browser context.
returns: >> Promise which resolves to an array of all open pages. Non visible pages, such as “background_page”, will not be listed here. You can find them using ().
An array of all pages inside the Browser. In case of multiple browser contexts,
the method will return an array with all the pages in all browser contexts.
returns: Spawned browser process. Returns null if the browser instance was created with nnect method.
returns:
A target associated with the browser.
returns: >
An array of all active targets inside the Browser. In case of multiple browser contexts,
the method will return an array with all the targets in all browser contexts.
returns: > Promise which resolves to the browser’s original user agent.
NOTE Pages can override browser user agent with tUserAgent
returns: > For headless Chromium, this is similar to HeadlessChrome/61. 3153. For non-headless, this is similar to Chrome/61. 0.
NOTE the format of rsion() might change with future releases of Chromium.
predicate A function to be run for every target
timeout Maximum wait time in milliseconds. Pass 0 to disable the timeout. Defaults to 30 seconds.
returns: > Promise which resolves to the first target found that matches the predicate function.
This searches for a target in all browser contexts.
An example of finding a target for a page opened via
await page. evaluate(() => (”));
const newWindowTarget = await browser. waitForTarget(
(target) => () === ”);
returns: Browser websocket URL.
Browser websocket endpoint which can be used as an argument to
nnect. The format is ws${host}:${port}/devtools/browser/
You can find the webSocketDebuggerUrl from ${host}:${port}/json/version. Learn more about the devtools protocol and the browser endpoint.
BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has
a single BrowserContext used by default. The method wPage() creates a page in the default browser context.
If a page opens another page, e. with a call, the popup will belong to the parent page’s browser
context.
Puppeteer allows creation of “incognito” browser contexts with eateIncognitoBrowserContext() method.
“Incognito” browser contexts don’t write any browsing data to disk.
// Create a new incognito browser context
// Create a new page inside context.
//… do stuff with page…
// Dispose context once it’s no longer needed.
await ();
Emitted when the URL of a target inside the browser context changes.
Emitted when a new target is created inside the browser context, for example when a new page is opened by or wPage.
Emitted when a target inside the browser context is destroyed, for example when a page is closed.
returns:
The browser this browser context belongs to.
Clears all permission overrides for the browser context.
const context = faultBrowserContext();
context. overridePermissions(”, [‘clipboard-read’]);
// do stuff..
earPermissionOverrides();
Closes the browser context. All the targets that belong to the browser context
will be closed.
NOTE only incognito browser contexts can be closed.
Returns whether BrowserContext is incognito.
The default browser context is the only non-incognito browser context.
NOTE the default browser context cannot be closed.
Creates a new page in the browser context.
origin The origin to grant permissions to, e. “.
permissions > An array of permissions to grant. All permissions that are not listed here will be automatically denied. Permissions can be one of the following values:
‘geolocation’
‘midi’
‘midi-sysex’ (system-exclusive midi)
‘notifications’
‘push’
‘camera’
‘microphone’
‘background-sync’
‘ambient-light-sensor’
‘accelerometer’
‘gyroscope’
‘magnetometer’
‘accessibility-events’
‘clipboard-read’
‘clipboard-write’
‘payment-handler’
‘persistent-storage’
await context. overridePermissions(”, [‘geolocation’]);
An array of all pages inside the browser context.
An array of all active targets inside the browser context.
This searches for a target in this specific browser context.
const newWindowTarget = await browserContext. waitForTarget(
Page provides methods to interact with a single tab or extension background page in Chromium. One Browser instance might have multiple Page instances.
This example creates a page, navigates it to a URL, and then saves a screenshot:
await reenshot({ path: ”});
The Page class emits various events (described below) which can be handled using
any of the EventEmitter methods, such as on, once
or off.
This example logs a message for a single page load event:
(‘load’, () => (‘Page loaded! ‘));
To unsubscribe from events use the off method:
function logRequest(interceptedRequest) {
(‘A request was made:’, ());}
(‘request’, logRequest);
// Sometime later…
Emitted when the page closes.

Emitted when JavaScript within the page calls one of console API methods, e. or Also emitted if the page throws an error or a warning.
The arguments passed into appear as arguments on the event handler.
An example of handling console event:
(‘console’, (msg) => {
for (let i = 0; i < (); ++i) (`${i}: ${()[i]}`);}); page. evaluate(() => (‘hello’, 5, { foo: ‘bar’}));

Emitted when a JavaScript dialog appears, such as alert, prompt, confirm or beforeunload. Puppeteer can respond to the dialog via Dialog’s accept or dismiss methods.
Emitted when the JavaScript DOMContentLoaded event is dispatched.

Emitted when the page crashes.
NOTE error event has a special meaning in Node, see error events for details.

Emitted when a frame is attached.
Emitted when a frame is detached.
Emitted when a frame is navigated to a new URL.
Emitted when the JavaScript load event is dispatched.

title The title passed to console. timeStamp.
metrics Object containing metrics as key/value pairs. The values
of metrics are of type.
Emitted when the JavaScript code makes a call to console. timeStamp. For the list
of metrics see trics.
The exception message
Emitted when an uncaught exception happens within the page.
Page corresponding to “popup” window
Emitted when the page opens a new tab or window.
const [popup] = await ([
new Promise((resolve) => (‘popup’, resolve)),
(‘a[target=_blank]’), ]);
page. evaluate(() => (”)), ]);

Emitted when a page issues a request. The HTTPRequest object is read-only.
In order to intercept and mutate requests, see tRequestInterception.
Emitted when a request fails, for example by timing out.
NOTE HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint,
Quick start | Tools for Web Developers

Quick start | Tools for Web Developers

Getting Started
Installation
To use Puppeteer in your project, run:
npm i puppeteer
# or “yarn add puppeteer”
puppeteer-core
Since version 1. 7. 0 we publish the puppeteer-core package,
a version of Puppeteer that doesn’t download any browser by default.
npm i puppeteer-core
# or “yarn add puppeteer-core”
puppeteer-core is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the
browser you intend to connect to.
See puppeteer vs puppeteer-core.
Usage
Puppeteer follows the latest maintenance LTS version of Node.
Puppeteer will be familiar to people using other browser testing frameworks. You create an instance
of Browser, open pages, and then manipulate them with Puppeteer’s API.
Example – navigating to and saving a screenshot as
Save file as
const puppeteer = require(‘puppeteer’);
(async () => {
const browser = await ();
const page = await wPage();
await (”);
await reenshot({ path: ”});
await ();})();
Execute script on the command line
node
Puppeteer sets an initial page size to 800×600px, which defines the screenshot size. The page size can be customized with tViewport().
Example – create a PDF.
await (”, {
waitUntil: ‘networkidle2’, });
await ({ path: ”, format: ‘a4’});
See () for more information about creating pdfs.
Example – evaluate script in the context of the page
// Get the “viewport” of the page, as reported by the page.
const dimensions = await page. evaluate(() => {
return {
width: ientWidth,
height: ientHeight,
deviceScaleFactor: vicePixelRatio, };});
(‘Dimensions:’, dimensions);
See Page. evaluate() for more information on evaluate and related methods like evaluateOnNewDocument and exposeFunction.
Default runtime settings
1. Uses Headless mode
Puppeteer launches Chromium in headless mode. To launch a full version of Chromium, set the headless option when launching a browser:
const browser = await ({ headless: false}); // default is true
2. Runs a bundled version of Chromium
By default, Puppeteer downloads and uses a specific version of Chromium so its API
is guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,
pass in the executable’s path when creating a Browser instance:
const browser = await ({ executablePath: ‘/path/to/Chrome’});
You can also use Puppeteer with Firefox Nightly (experimental support). See () for more information.
See this article for a description of the differences between Chromium and Chrome. This article describes some differences for Linux users.
3. Creates a fresh user profile
Puppeteer creates its own browser user profile which it cleans up on every run.
Next steps
Learn more about headless Chrome
Look over the examples.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4. 0 License, and code samples are licensed under the Apache 2. 0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-09-22 UTC.
[{
“type”: “thumb-down”,
“id”: “missingTheInformationINeed”,
“label”:”Missing the information I need”}, {
“id”: “tooComplicatedTooManySteps”,
“label”:”Too complicated / too many steps”}, {
“id”: “outOfDate”,
“label”:”Out of date”}, {
“id”: “samplesCodeIssue”,
“label”:”Samples / code issue”}, {
“id”: “otherDown”,
“label”:”Other”}]
“type”: “thumb-up”,
“id”: “easyToUnderstand”,
“label”:”Easy to understand”}, {
“id”: “solvedMyProblem”,
“label”:”Solved my problem”}, {
“id”: “otherUp”,
“label”:”Other”}]
Puppeteer (video game) - Wikipedia

Puppeteer (video game) – Wikipedia

PuppeteerDeveloper(s)Japan StudioPublisher(s)Sony Computer EntertainmentDirector(s)Gavin MooreProducer(s)Takashi MizutaniDesigner(s)Kazunobu SatoComposer(s)Patrick DoylePlatform(s)PlayStation 3ReleaseJP: September 5, 2013[1]NA: September 10, 2013 EU: September 11, 2013Genre(s)PlatformerMode(s)Single-player
Puppeteer (パペッティア) is a platform video game developed by Japan Studio for the PlayStation 3. [2][3] It was directed by Gavin Moore. The game was released worldwide in September 2013.
It is playable in both traditional 2D and in 3D. Gavin Moore says Puppeteer plays better in 3D than other games because the camera does not move and his team used a method of 3D that has not resulted in a reduced framerate. [4]
Gameplay[edit]
Puppeteer is a side-scrolling platformer in which the player controls the character ‘Kutaro’: a boy changed into an animated puppet and immediately decapitated. Throughout the game, Kutaro obtains various heads to replace his own, each enabling access to certain animations, and referring to the adjacent scenery. If Kutaro is damaged by an enemy or obstacle, he loses his head. Should the player not retrieve the head within a few seconds, it will disappear. Kutaro can hold three heads at a time, and when they are all lost, he restarts from the last checkpoint. The player can earn an extra life by collecting 100 “Moonsparkles” in a given section of the game.
Throughout most of the story, Kutaro is armed with a pair of magical scissors, known as ‘Calibrus’, enabling him to cut through some portions of the scenery, and thus to reach otherwise inaccessible areas. He later acquires the abilities of the Four Champions of the Moon: the Knight’s shield to defend against damage and reflect attacks, the Ninja’s bombs to attack enemies and break obstacles, the Pirate’s hook to grapple and pull enemies and change the scenery, and the Wrestler’s mask and strength to body slam enemies and pull and push obstacles. His stated object is to acquire the shards of ‘Moonstone’ from the game’s villains (in the process removing their influence from the scenery) and to free the souls of children like himself, from the malevolent figures containing them, all the while saving a Goddess in distress.
The game is playable by one or two players. If two are playing, the second player controls Kutaro’s companion (initially a ghostly cat named ‘Ying-Yang’; later the fairylike ‘Pikarina’), who can examine the scenery for foreign objects and find interactables, moonsparkles, and new heads for Kutaro. In single-player mode, the two analog sticks on the joypad each control a character.
The game is presented as a puppet show in front of an audience, who can be heard cheering and laughing when impressive actions take place. It is divided into seven “acts”, each of which comprise three “curtains”. Each curtain has a set number of heads to collect, a set number of souls to rescue, and a hidden area to discover. For 100% completion, the player must revisit old curtains with new heads to complete it.
Plot[edit]
The story occurs in a concave world representing Earth’s Moon, inhabited by pseudo-folkloric characters: the first half on the dark side of the Moon, and the second half on the Earthward side. Its premise states that the world’s ruler, the Moon Goddess, was overthrown by her subordinate, Little Bear, when the latter seized her ‘Black Moonstone’ and the magic scissor-set ‘Calibrus’, and declared himself ‘Moon Bear King’. Throughout the game, each of his twelve generals (the animals of the Chinese zodiac) has set part of the moon-world in disorder: each holding a portion of the Goddess’ ‘White Moonstone. ’
The player-character ‘Kutaro’ is one of many children whose souls were spirited away from Earth in their sleep and changed into animated wooden puppets to be enslaved in the King’s mobile fortress, Castle Grizzlestein. After having his head pulled off and his soul devoured by the Moon Bear King, Kutaro is found in the dungeons by the Goddess’s cat, Ying Yang, who leads him to his current mistress, the Moon Witch Ezma Potts. Potts, who is secretly planning overthrow the Moon Bear King herself, orders Kutaro to sneak into the throne room and capture the magic pair of scissors Calibrus. This weapon allows Kutaro to dispel the King’s magic and defeat his puppets to release the souls within, allowing them to escape back to Earth. When the Witch demands the scissors, they adhere to Kutaro, and she allows him to use Calibrus to oppose the twelve generals. During the defeat of the first (General Tiger), Kutaro rescues Pikarina, Princess of the Sun, whom the Moon Bear King had captured. Under Potts’ guidance, Kutaro and Pikarina venture to the various realms of the moon, to vanquish each general in turn: the Moonwood Forest guarded by Rat and Snake, the Moonshine Sea patrolled by Pig and Sheep, the Wild Wastes trampled by Bull and Horse, Hallowee-Ville controlled by Dog and Monkey, and the Land of Time conquered by Rabbit and Rooster, ultimately facing off against Dragon.
When the White Moonstone is re-assembled, Potts revealed to be as the Moon Goddess as she transforms back; but is instantly trapped by the Moon Bear King, and must be rescued by Kutaro. Propelled thereto by a cannon, Kutaro and Pikarina disable Castle Grizzlestein and reduce the Moon Bear King to his former shape of Little Bear, who surrenders the Black Moonstone in exchange for Kutaro’s friendship, and restores Kutaro’s head. All the twelve Generals are resurrected and converted from evil to good; and Kutaro, accompanied by Calibrus and Ying Yang, returns to Earth.
Development[edit]
On July 21, 2010, Sony filed a trademark titled Puppeteer. It has been speculated that it would be a game that would make use of the PlayStation Move technology in order to control the main character. Two years later, the trademark was later revealed to be indeed for a game with its official announcement at Gamescom 2012.
In December 2012, Gavin Moore, the director of the video game, posted an entry on the European PlayStation Blog, stating that the video game is “Shaping up nicely, playing great and looking awesome. From January we will be polishing, refining and adding extra little details, to make the whole experience something fantastical and wonderful that PlayStation fans deserve. I will be in London for two weeks doing the Voice recordings in January, popping across to Budapest for the music recordings, then back to Japan with all my wonderful assets to shove them lovingly into the game. This is one of my favourite parts of game creation. Getting the final assets into the game really brings everything together. “[5]
Reception[edit]
Puppeteer received “generally favorable” reviews, according to review aggregator Metacritic.
References[edit]
^ 『パペッティア』の発売日が2013年9月5日に決定! 価格は5980円[税込] (in Japanese). Famitsu. 2013-06-27. Retrieved 2013-07-27.
^ “Puppeteer – IGN”.
^ “Archived copy”. Archived from the original on 2012-08-18. Retrieved 2012-08-15. CS1 maint: archived copy as title (link)
^ Rutledge, Daniel (26 October 2012). “Puppeteer – a weird, wild PS3 adventure”. 3 News NZ. Archived from the original on 4 October 2013. Retrieved 28 October 2012.
^ “Happy holidays from the Puppeteer team! “. 18 December 2012.
^ “Puppeteer for PlayStation 3 Reviews”. Metacritic. Retrieved 2021-09-05.
^ Moriarty, Colin (5 September 2021). “Puppeteer Review”. IGN. Retrieved 5 September 2021.
^ Walton, Mark (5 September 2021). GameSpot. Retrieved 5 September 2021.
^ Whitehead, Dan (5 September 2021). “Puppeteer review”. Eurogamer. Retrieved 5 September 2021.
^ “Puppeteer Review (PS3) | Aces high”. Push Square. 5 September 2021. Retrieved 5 September 2021.
^ Sterling, Jim (5 September 2021). “Review: Puppeteer”. Destructoid. Retrieved 5 September 2021.
^ Moutinho, Eduardo (5 September 2021). “Puppeteer’s endearing whimsy makes it worth the price of admission (review)”. VentureBeat. Retrieved 5 September 2021.
^ Marchiafava, Jeff (5 September 2021). “Puppeteer – Japan Studio Delivers A Rousing Stage Performance”. Game Informer. Retrieved 5 September 2021.
^ “Puppeteer review | Aces high”. Electronic Gaming Monthly. GamesRadar. Retrieved 5 September 2021.
^ Gies, Arthur (5 September 2021). “Puppeteer review: strings attached”. Polygon. Retrieved 5 September 2021.
External links[edit]
Official UK website
Official US website
Official Japanese website

Frequently Asked Questions about puppeteer launch

What is puppeteer launch?

Overview. Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. … Puppeteer communicates with the browser using DevTools Protocol.

When was puppeteer released?

Puppeteer (video game)PuppeteerPlatform(s)PlayStation 3ReleaseJP: September 5, 2013 NA: September 10, 2013 EU: September 11, 2013Genre(s)PlatformerMode(s)Single-player7 more rows

How do I launch a puppeteer browser?

To use Puppeteer with a different version of Chrome or Chromium, pass in the executable’s path when creating a Browser instance: const browser = await puppeteer. launch({ executablePath: ‘/path/to/Chrome’ }); You can also use Puppeteer with Firefox Nightly (experimental support).Sep 22, 2021

Leave a Reply

Your email address will not be published. Required fields are marked *

Theme Blog Tales by Kantipur Themes