Captcha solving in browser sessions
Have String solve captchas and challenge pages before your browser session's page loads them.
Add solveCaptcha=true to the /wss connect URL and String solves a captcha or challenge page that a navigation
lands on, so your page loads the page you asked for. Leave it off when your code handles challenges itself, or when
navigation time matters more than loading the page behind a challenge.
Connect with solveCaptcha
import { chromium } from "playwright-core";
const browser = await chromium.connectOverCDP("wss://request.usestring.ai/v1/wss?solveCaptcha=true", {
headers: { Authorization: `Bearer ${process.env.STRING_API_KEY}` }
});
const page = await browser.contexts()[0].newPage();
const response = await page.goto("https://example.com/");
console.log(response?.status(), page.url());
await browser.close();When the navigation meets a challenge, goto stays pending while String solves it, then resolves on the page
behind it:
200 https://example.com/If the site redirects after the challenge, the navigation follows that redirect and page.url() is where it ended.
If the challenge can't be solved, the navigation resolves on the challenge page, as it would without the parameter.
Rules and limits
- Off by default. Unlike on
/fetch, nothing is solved unless you setsolveCaptcha=true. - Key permission. Your API key must be allowed to solve captchas. With a key that isn't, the parameter is ignored and the session runs without solving.
- Top-level
GETnavigations only. Challenges in iframes, infetchor XHR requests, or in response to a formPOSTreach your page unchanged. - Navigation time. A solve keeps a navigation pending for at most 22 seconds. Keep your navigation timeout at 30 seconds or more, the default in Playwright and Puppeteer.
- One solve at a time per session. A page in another tab that meets a challenge during a solve gets the challenge page.
- 25 solve attempts per session. Failed attempts count. Later challenges in the session reach your page unchanged. Reconnect to solve more.
- Failed URLs wait 60 seconds. After a solve fails, the same URL loads its challenge page without a new attempt for 60 seconds.
Billing
Solving has no charge of its own. The session bills at its usual bandwidth and duration rates, and the traffic a solve uses counts toward its bandwidth.