Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
playwright-extra
Advanced tools
A modular plugin framework for playwright to enable cool plugins through a clean interface.
yarn add playwright playwright-extra
# - or -
npm install playwright playwright-extra
// playwright-extra is a drop-in replacement for playwright,
// it augments the installed playwright with plugin functionality
// Note: Instead of chromium you can use firefox and webkit as well.
const { chromium } = require('playwright-extra')
// import and configure the recaptcha plugin
const RecaptchaPlugin = require('@extra/recaptcha')
const recaptcha = RecaptchaPlugin({
provider: {
id: '2captcha',
token: 'XXXXXXX' // Replace this with your own 2captcha api key
}
})
// add the plugin to playwright
chromium.use(recaptcha)
// playwright usage as normal
chromium.launch({ headless: true }).then(async browser => {
const page = await browser.newPage()
await page.goto('https://www.google.com/recaptcha/api2/demo')
// That's it, a single line of code to solve reCAPTCHAs and hCaptchas 🎉
await page.solveRecaptchas()
await Promise.all([
page.waitForNavigation(),
page.click(`#recaptcha-demo-submit`)
])
await page.screenshot({ path: 'response.png', fullPage: true })
await browser.close()
})
The above example uses the recaptcha
plugin, which needs to be installed as well:
yarn add @extra/recaptcha
# - or -
npm install @extra/recaptcha
If you'd like to see debug output just run your script like so:
DEBUG=automation-extra,automation-extra-plugin:* node myscript.js
playwright-extra
and most plugins are written in TS, so you get perfect type support out of the box. :)
import { chromium } from 'playwright-extra'
// if you need types as well:
import { chromium, Playwright } from 'playwright-extra'
@extra/recaptcha
page.solveRecaptchas()
Note
playwright-extra
is brand new, we're in the process of porting over existing puppeteer-extra
plugins with Firefox & Webkit support. If you depend on having a large list of pre-made plugins available we suggest you use puppeteer-extra
for the moment. See also: Playwright vs Puppeteer
Write your own plugin
Making custom plugins which work with Playwright and Puppeteer is easy and fun. It might even make your own code base more maintainable and modular. Head over to the documentation here: automation-extra-plugin
launcher
PlaywrightBrowserLauncher Playwright (or compatible) browser launcherReturns: PlaywrightExtra
Augment the provided Playwright browser launcher with plugin functionality.
Using addExtra
will always create a fresh PlaywrightExtra instance.
Example:
import playwright from 'playwright'
import { addExtra } from 'playwright-extra'
const chromium = addExtra(playwright.chromium)
chromium.use(plugin)
This object can be used to launch or connect to Chromium, returning instances of ChromiumBrowser.
The default exports will behave exactly the same as the regular playwright (just with extra plugin functionality) and can be used as a drop-in replacement.
Behind the scenes it will try to require either playwright
or playwright-core
from the installed dependencies.
Please note that due to imports being cached this will result in a single
PlaywrightExtra instance, even when used in different files. If you need multiple
instances (e.g. different plugins) please use addExtra
.
Example:
// javascript import
const { chromium } = require('playwright-extra')
// typescript/es6 module import
import { chromium } from 'playwright-extra'
// Add plugins
chromium.use(...)
This object can be used to launch or connect to Firefox, returning instances of FirefoxBrowser.
This object can be used to launch or connect to WebKit, returning instances of WebKitBrowser.
Returns playwright specific errors
Selectors can be used to install custom selector engines.
Returns a list of devices to be used with browser.newContext([options]) or browser.newPage([options]).
Copyright © 2018 - 2021, berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘. Released under the MIT License.
FAQs
Teach playwright new tricks through plugins.
The npm package playwright-extra receives a total of 32,390 weekly downloads. As such, playwright-extra popularity was classified as popular.
We found that playwright-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.