Package Exports
- @gatesolve/playwright-plugin
- @gatesolve/playwright-plugin/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@gatesolve/playwright-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@gatesolve/playwright-plugin
Automatic CAPTCHA solving for Playwright. Detects Cloudflare Turnstile, reCAPTCHA, and hCaptcha challenges and solves them via GateSolve.
Install
npm install @gatesolve/playwright-pluginQuick Start
One-shot: Solve CAPTCHA on current page
import { chromium } from 'playwright';
import { solveOnPage } from '@gatesolve/playwright-plugin';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com/login');
// Detect and solve any CAPTCHA on the page
const result = await solveOnPage(page, {
apiKey: 'gs_your_key_here', // Free at gatesolve.dev
});
if (result?.success) {
console.log(`Solved ${result.type} in ${result.solveTimeMs}ms`);
// Token is already injected into the page — submit the form
await page.click('button[type="submit"]');
}Auto-solve: Wrap browser context
import { chromium } from 'playwright';
import { withGateSolve } from '@gatesolve/playwright-plugin';
const browser = await chromium.launch();
const context = await browser.newContext();
// Every page in this context will auto-solve CAPTCHAs
withGateSolve(context, {
apiKey: 'gs_your_key_here',
debug: true,
});
const page = await context.newPage();
await page.goto('https://example.com/protected');
// CAPTCHA is solved automatically on page loadDetect only (no solve)
import { detectCaptcha } from '@gatesolve/playwright-plugin';
const detection = await detectCaptcha(page);
if (detection) {
console.log(`Found ${detection.type} with siteKey ${detection.siteKey}`);
}API
solveOnPage(page, options)
Detect and solve a CAPTCHA on the current page. Returns SolveResult | null.
withGateSolve(context, options)
Wrap a BrowserContext to auto-solve CAPTCHAs on every page load. Returns the same context.
detectCaptcha(page)
Detect CAPTCHA type and siteKey without solving. Returns CaptchaDetection | null.
Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | GateSolve API key |
baseUrl |
string |
https://gatesolve.dev |
API base URL |
timeout |
number |
30000 |
Max solve wait (ms) |
pollInterval |
number |
2000 |
Poll frequency (ms) |
debug |
boolean |
false |
Log debug info |
Supported CAPTCHAs
- Cloudflare Turnstile — $0.02/solve
- reCAPTCHA v2/v3 — $0.03/solve
- hCaptcha — $0.03/solve
Free Tier
100 free solves per API key. No credit card required. Get your key at gatesolve.dev.
License
MIT