Gathering detailed insights and metrics for puppeteer-extra-plugin
Gathering detailed insights and metrics for puppeteer-extra-plugin
Gathering detailed insights and metrics for puppeteer-extra-plugin
Gathering detailed insights and metrics for puppeteer-extra-plugin
puppeteer-extra-plugin-stealth
Stealth mode: Applies various techniques to make detection of headless puppeteer harder.
puppeteer-extra-plugin-user-preferences
Launch puppeteer with arbitrary user preferences.
puppeteer-extra-plugin-user-data-dir
Custom user data directory for puppeteer.
puppeteer-extra-plugin-recaptcha
A puppeteer-extra plugin to solve reCAPTCHAs and hCaptchas automatically.
💯 Teach puppeteer new tricks through plugins.
npm install puppeteer-extra-plugin
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.9
Supply Chain
97.5
Quality
74
Maintenance
100
Vulnerability
100
License
JavaScript (59.86%)
TypeScript (39.86%)
HTML (0.19%)
Shell (0.09%)
Total Downloads
53,724,102
Last Day
28,554
Last Week
341,975
Last Month
1,496,596
Last Year
17,735,638
MIT License
6,906 Stars
604 Commits
758 Forks
115 Watchers
5 Branches
49 Contributors
Updated on Jul 01, 2025
Minified
Minified + Gzipped
Latest Version
3.2.3
Package Id
puppeteer-extra-plugin@3.2.3
Unpacked Size
144.74 kB
Size
19.49 kB
File Count
16
NPM Version
lerna/3.22.1/node@v18.12.1+arm64 (darwin)
Node Version
18.12.1
Published on
Mar 01, 2023
Cumulative downloads
Total Downloads
Last Day
-3.5%
28,554
Compared to previous day
Last Week
-4.7%
341,975
Compared to previous week
Last Month
5.2%
1,496,596
Compared to previous month
Last Year
20.3%
17,735,638
Compared to previous year
3
2
1yarn add puppeteer-extra-plugin
1// Before 2const PuppeteerExtraPlugin = require('puppeteer-extra-plugin') 3 4// After (>= v3.0.1) 5const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')
opts
PluginOptions?Base class for puppeteer-extra
plugins.
Provides convenience methods to avoid boilerplate.
All common puppeteer
browser events will be bound to
the plugin instance, if a respectively named class member is found.
Please refer to the puppeteer API documentation as well.
Example:
1// hello-world-plugin.js 2const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') 3 4class Plugin extends PuppeteerExtraPlugin { 5 constructor(opts = {}) { 6 super(opts) 7 } 8 9 get name() { 10 return 'hello-world' 11 } 12 13 async onPageCreated(page) { 14 this.debug('page created', page.url()) 15 const ua = await page.browser().userAgent() 16 this.debug('user agent', ua) 17 } 18} 19 20module.exports = function(pluginConfig) { 21 return new Plugin(pluginConfig) 22} 23 24// foo.js 25const puppeteer = require('puppeteer-extra') 26puppeteer.use(require('./hello-world-plugin')()) 27;(async () => { 28 const browser = await puppeteer.launch({ headless: false }) 29 const page = await browser.newPage() 30 await page.goto('http://example.com', { waitUntil: 'domcontentloaded' }) 31 await browser.close() 32})()
Type: string
Plugin name (required).
Convention:
puppeteer-extra-plugin-anonymize-ua
anonymize-ua
Example:
1get name () { return 'anonymize-ua' }
Type: PluginOptions
Plugin defaults (optional).
If defined will be (deep-)merged with the (optional) user supplied options (supplied during plugin instantiation).
The result of merging defaults with user supplied options can be accessed through this.opts
.
Example:
1get defaults () { 2 return { 3 stripHeadless: true, 4 makeWindows: true, 5 customFn: null 6 } 7} 8 9// Users can overwrite plugin defaults during instantiation: 10puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))
Type: PluginRequirements
Plugin requirements (optional).
Signal certain plugin requirements to the base class and the user.
Currently supported:
launch
puppeteer.connect()
),
will output a warning to the user.headful
headless: true
mode,
will output a warning to the user.dataFromPlugins
this.getDataFromPlugins()
.runLast
Example:
1get requirements () { 2 return new Set(['runLast', 'dataFromPlugins']) 3}
Type: PluginDependencies
Plugin dependencies (optional).
Missing plugins will be required() by puppeteer-extra.
Example:
1get dependencies () { 2 return new Set(['user-preferences']) 3} 4// Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.
Type: Array<PluginData>
Plugin data (optional).
Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,
that list the dataFromPlugins
requirement (by using this.getDataFromPlugins()
).
Convention: [ {name: 'Any name', value: 'Any value'} ]
Example:
1// plugin1.js 2get data () { 3 return [ 4 { 5 name: 'userPreferences', 6 value: { foo: 'bar' } 7 }, 8 { 9 name: 'userPreferences', 10 value: { hello: 'world' } 11 } 12 ] 13 14// plugin2.js 15get requirements () { return new Set(['dataFromPlugins']) } 16 17async beforeLaunch () { 18 const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) 19 this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] 20}
Type: PluginOptions
Access the plugin options (usually the defaults
merged with user defined options)
To skip the auto-merging of defaults with user supplied opts don't define a defaults
property and set the this._opts
Object in your plugin constructor directly.
Example:
1get defaults () { return { foo: "bar" } } 2 3async onPageCreated (page) { 4 this.debug(this.opts.foo) // => bar 5}
Type: Debugger
Convenience debug logger based on the debug module. Will automatically namespace the logging output to the plugin package name.
1# toggle output using environment variables 2DEBUG=puppeteer-extra-plugin:<plugin_name> node foo.js 3# to debug all the things: 4DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js
Example:
1this.debug('hello world') 2// will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'
options
any Puppeteer launch optionsBefore a new browser instance is created/launched.
Can be used to modify the puppeteer launch options by modifying or returning them.
Plugins using this method will be called in sequence to each be able to update the launch options.
Example:
1async beforeLaunch (options) { 2 if (this.opts.flashPluginPath) { 3 options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) 4 } 5}
browser
Puppeteer.Browser The puppeteer
browser instance.opts
(optional, default {options:({}as Puppeteer.LaunchOptions)}
)After the browser has launched.
Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
It's possible that pupeeteer.launch
will be called multiple times and more than one browser created.
In order to make the plugins as stateless as possible don't store a reference to the browser instance
in the plugin but rather consider alternatives.
E.g. when using onPageCreated
you can get a browser reference by using page.browser()
.
Alternatively you could expose a class method that takes a browser instance as a parameter to work with:
1const fancyPlugin = require('puppeteer-extra-plugin-fancy')() 2puppeteer.use(fancyPlugin) 3const browser = await puppeteer.launch() 4await fancyPlugin.killBrowser(browser)
Example:
1async afterLaunch (browser, opts) { 2 this.debug('browser has been launched', opts.options) 3}
options
Object Puppeteer connect optionsBefore connecting to an existing browser instance.
Can be used to modify the puppeteer connect options by modifying or returning them.
Plugins using this method will be called in sequence to each be able to update the launch options.
browser
Puppeteer.Browser The puppeteer
browser instance.opts
Object (optional, default {}
)
opts.options
Object Puppeteer connect options used.After connecting to an existing browser instance.
Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
browser
Puppeteer.Browser The puppeteer
browser instance.opts
anyReturns: Promise<void>
Called when a browser instance is available.
This applies to both puppeteer.launch()
and puppeteer.connect()
.
Convenience method created for plugins that need access to a browser instance
and don't mind if it has been created through launch
or connect
.
Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
target
Puppeteer.TargetCalled when a target is created, for example when a new page is opened by window.open or browser.newPage.
Note: This includes target creations in incognito browser contexts.
Note: This includes browser instances created through
.launch()
as well as.connect()
.
page
Puppeteer.Pagetarget
Puppeteer.TargetSame as onTargetCreated
but prefiltered to only contain Pages, for convenience.
Note: This includes page creations in incognito browser contexts.
Note: This includes browser instances created through
.launch()
as well as.connect()
.
Example:
1async onPageCreated (page) { 2 let ua = await page.browser().userAgent() 3 if (this.opts.stripHeadless) { 4 ua = ua.replace('HeadlessChrome/', 'Chrome/') 5 } 6 this.debug('new ua', ua) 7 await page.setUserAgent(ua) 8}
target
Puppeteer.TargetCalled when the url of a target changes.
Note: This includes target changes in incognito browser contexts.
Note: This includes browser instances created through
.launch()
as well as.connect()
.
target
Puppeteer.TargetCalled when a target is destroyed, for example when a page is closed.
Note: This includes target destructions in incognito browser contexts.
Note: This includes browser instances created through
.launch()
as well as.connect()
.
Called when Puppeteer gets disconnected from the Chromium instance.
This might happen because of one of the following:
browser.disconnect
method was calledDeprecated: Since puppeteer v1.6.0 onDisconnected
has been improved
and should be used instead of onClose
.
In puppeteer < v1.6.0 onDisconnected
was not catching all exit scenarios.
In order for plugins to clean up properly (e.g. deleting temporary files)
the onClose
method had been introduced.
Note: Might be called multiple times on exit.
Note: This only includes browser instances created through
.launch()
.
After the plugin has been registered in puppeteer-extra
.
Normally right after puppeteer.use(plugin)
is called
name
string? Filter data by name
propertyReturns: Array<PluginData>
Helper method to retrieve data
objects from other plugins.
A plugin needs to state the dataFromPlugins
requirement
in order to use this method. Will be mapped to puppeteer.getPluginData
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
63 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More