manage to solve captcha challenges with puppeteer
npm install puppeteer-extra-plugin-capsolvermanage to solve captcha challenges with puppeteer
- ❗ API key it's required Get here


npm i puppeteer puppeteer-extra puppeteer-extra-plugin-capsolver
- Import puppeteer-extra and the plugin package
``typescript`
const puppeteer = require("puppeteer-extra");
const {
SolverPlugin,
SolverPluginError,
SolverError,
} = require("puppeteer-extra-plugin-capsolver");
#### Auto-load official Browser Extension
- How it works? This feature would auto-load the extension from a zipped file into static temp folder on your disk, then would load from there on demand refreshing apiKey on load.
- How to use with from the plugin?
- Set useExtension on plugin init.await page.waitForSolverCallback({ timeout })
- Control the extension with .
`typescript
puppeteer.use(
new SolverPlugin({
apiKey: process.env.APIKEY,
useExtension: true, // this will auto-load the extension and apiKey
useExtensionProxy: process.env.PROXYSTRING, // force proxy string on solving
useExtensionReCaptchaMode: "token", // click or token mode
})
);
// ...
await page.waitForSolverCallback({
// timeout: 120000,
});
`
#### Common usage: call the API
- How it works? Make use of capsolver-npm package to perform API calls for solution retrieving.
- How to use with from the plugin?
- Call to await page.solver(). from any Page.
`typescript
puppeteer.use(
new SolverPlugin({
apiKey: process.env.APIKEY,
})
);
// ...
await page
.solver()
.recaptchav2classification({
// ... parameters
})
.then((s: any) => {
console.log(s);
})
.catch((e: SolverError) => {
console.log(Errored task Id: ${e.errorTaskId});Error Code: ${e.errorCode}
console.log();Error description: ${e.errorDescription}
console.log();``
});
Figure out here.
#### Disclaimer
By using this package, you acknowledge and agree that:
- You are solely responsible for how you use the API and the author does not assume any liability for misuse, abuse, or violations of Capsolver’s terms of service.
- This package provides a service connector for the Capsolver API and is not affiliated.