Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
puppeteer-extra-plugin-repl
Advanced tools
A plugin for puppeteer-extra.
yarn add puppeteer-extra-plugin-repl
Make quick puppeteer debugging and exploration fun with an interactive REPL.
.repl()
methods to Page
and Browser
instances.const puppeteer = require('puppeteer-extra')
puppeteer.use(require('puppeteer-extra-plugin-repl')())
puppeteer.launch({ headless: true }).then(async browser => {
const page = await browser.newPage()
await page.goto('https://example.com')
// Start an interactive REPL here with the `page` instance.
await page.repl()
// Afterwards start REPL with the `browser` instance.
await browser.repl()
await browser.close()
})
In the REPL session (hit tab
two times to see all available properties):
> page.url()
// => https://example.com
> page.click('a')
> page.url()
// => https://www.iana.org/domains/reserved
> page.content()
// => <!DOCTYPE html><html><head> ...
> page.goto('https://google.com')
> page.type('input', 'what is the answer to life the universe and everything')
> page.click('input[type=submit]')
> page.url()
// => https://www.google.com/search?source=hp&ei=u9oXW5HpO8a ...
> page.evaluate(() => document.querySelector('h3 a').textContent)
// => Question 42 (The Impossible Quiz) - The Impossible Quiz Wiki - Fandom
inspect
to return the current object.exit
(or hit ctrl+c) to leave the repl.Extends: PuppeteerExtraPlugin
Interrupt your puppeteer code with an interactive REPL.
Features tab auto-completion for the given object properties and a colorized prompt.
Works with arbitrary objects ands class instances, though Page
& Browser
make the most sense. :-)
opts
Type: function (opts)
opts
Object Options (optional, default {}
)
opts.addToPuppeteerClass
boolean? If a .repl()
method should be attached to Puppeteer Page
and Browser
instances (default: true).Example:
// In this example we don't extend the native puppeteer classes
const puppeteer = require('puppeteer-extra')
const repl = require('puppeteer-extra-plugin-repl')({ addToPuppeteerClass: false })
puppeteer.use(repl)
puppeteer.launch({ headless: true }).then(async browser => {
const page = await browser.newPage()
await page.goto('https://example.com')
// Start an interactive REPL here with the `page` instance.
await repl.repl(page)
// Afterwards start REPL with the `repl` instance itself. 🐴
await repl.repl(repl)
await browser.close()
})
Create an interactive REPL for the provided object.
Uses an extended (colorized) readline interface under the hood. Will resolve the returned Promise when the readline interface is closed.
If opts.addToPuppeteerClass
is true (default) then page.repl()
/browser.repl()
will point to this method, for convenience.
Can be used standalone as well, to inspect an arbitrary class instance or object.
Type: function (obj): Promise
obj
Object An object or class instance to use in the repl (e.g. page
, browser
)Example:
const repl = require('puppeteer-extra-plugin-repl')()
await repl.repl(<object or class instance to inspect>)
FAQs
Start an interactive REPL in your puppeteer code.
We found that puppeteer-extra-plugin-repl 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.