kpsdk-solver
A Playwright-based solver for Kasada's bot defense platform.
Available as a replacement to Browser.newPage()
and BrowserContext.newPage()
Features
- Extensive manipulation of the Kasada SDK
- Use custom script import
- Use custom configuration
- Inspect SDK messages
- Interact with Kasada's Fetch API
- Use same-page client token regeneration
- Support for CommonJS (CJS) and ECMAScript module (ESM) use
- Seamless integration with the Playwright library
Limitations
- Only compatible with Playwright
- Fails to bypass detection on... (based on common issues - results may vary)
Installation
$ npm install kpsdk-solver
Usage
import playwright from 'playwright';
import Solver from 'kpsdk-solver';
const solver = new Solver(config);
(async () => {
const browser = await playwright.firefox.launch({ headless: true });
const context = await browser.newContext();
const page = await solver.create(context, page => {
console.log(page.url());
});
console.log(page.solver.messages);
const { route, request } = await page.solver.fetch('/api/kasada-protected-endpoint');
console.log(request.headers());
await route.abort();
await page.close();
await context.close();
await browser.close();
})();
Configuration
{
kasada: [{
domain: 'some-domain.com',
method: 'POST',
path: '/api/kasada-protected-endpoint',
protocol: 'https:'
}],
'load-complete': false,
'request-tracing': false,
'sdk-script': {
url: 'https://some-domain.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/p.js'
},
url: 'https://some-domain.com'
}