A simple puppeteer wrapper to enable useful plugins with ease
A simple puppeteer
wrapper to enable useful plugins with ease
Requires node v10 and higher
npm install puppeteer-pro
Puppeteer-Pro can do all the same things as puppeteer
, just now with plugins!
// Puppeteer-Pro is a drop-in replacement for puppeteer
const PuppeteerPro = require('puppeteer-pro');
// Enable the 'avoidDetection' plugin to prevent headless detection
PuppeteerPro.avoidDetection();
// Enable the 'solveRecaptchas' plugin to solve Google's recaptchas (remember to provide a wit.api API access token)
const solver = PuppeteerPro.solveRecaptchas('WIT_AI_ACCESS_TOKEN');
(async () => {
const browser = await PuppeteerPro.launch();
const page = await browser.newPage();
console.log('Testing the 🐱👤 avoidDetection 🐱👤 plugin..')
await page.goto('https://arh.antoinevastel.com/bots/areyouheadless');
await page.screenshot({ path: 'are-you-headless.png' });
console.log('Testing the recaptcha solver..')
await page.goto('https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php');
await solver.waitForCaptcha(page); // Captcha script is deferred, so will load after page.goto completes
await solver.solveRecaptcha(page);
await page.screenshot({ path: 'is-recaptcha-solved.png' });
await browser.close();
})();
respond
, followed by abort
, followed by continue
. For example:
respond
. This will occur after the first respond is called and not when all handlers are finished.abort
. This will occur after all handlers are finished.continue
. This will occur after all handlers are finished.