Solve CAPTCHAs in Octoparse AI with DeathByCaptcha
An Octoparse AI flow stops at the same place every automation does: a protected form appears, and the workflow has no idea what to type. The fix is a block that asks DeathByCaptcha for the answer and writes it into the page.
First, which Octoparse
Octopus Data ships two products and they do not share commands:
| Octoparse AI (octoparse.ai) | Octoparse (octoparse.com) | |
|---|---|---|
| What it is | Windows RPA tool | Visual web scraper |
| Execute Python code | yes | no |
| Send HTTP Request | yes | no |
| Built-in CAPTCHA | image, slider, rotation, text click, drawing path | image, reCAPTCHA v2/v3, Cloudflare |
This guide is for Octoparse AI, the one with the code blocks. The
visual scraper has no code to paste: for it, use its own Solve CAPTCHA
step, or solve here and hand the session over with the Use cookie
option of the Go to Web Page step.
Install
Octoparse AI runs the block on the Python installed on your machine:
pip install deathbycaptcha-official
Then put the account in the user environment variables of the machine that runs Octoparse:
DBC_AUTHTOKEN=your_authtoken
or DBC_USERNAME and DBC_PASSWORD. Never in the code of the flow: a
screenshot of a flow is easier to share than you think.
Add the block
Add command → Others → Execute Python code, paste
octoparse_block.py from the client, and turn on Use local Python
environment. Left off, the block runs on the built-in runtime and
import deathbycaptcha fails.
| Function | Type | Arguments | Returns |
|---|---|---|---|
solve_image |
0 | image_path, timeout |
the text to type |
solve_recaptcha_v2 |
4 | sitekey, pageurl, timeout |
the token |
solve_recaptcha_v3 |
5 | sitekey, pageurl, action, min_score |
the token |
solve_turnstile |
12 | sitekey, pageurl, timeout |
the token |
get_balance |
— | nothing | balance in US cents |
An empty timeout keeps the client's own default: sixty seconds for an
image, a hundred twenty for a token.
Flow A: an image CAPTCHA
- Take screenshot of web page →
{shot}. - Execute Python code →
solve_image({shot})→{answer}. - Fill text field on web page ←
{answer}. - Click element on web page on the submit button.
- If web page contains the error text → retry, up to a fixed number of attempts. An unbounded loop burns balance on a page that will never accept the answer.
Flow B: a reCAPTCHA v2 token
The token has to reach the widget, so this part is JavaScript in the page. Test it on your own page first.
- Execute Python code →
solve_recaptcha_v2({sitekey}, {pageurl})→{token}. - Run JavaScript function on web page with
{token}as the argument:
function (token) {
var box = document.getElementById('g-recaptcha-response');
if (!box) { return 'no g-recaptcha-response field'; }
box.value = token;
box.dispatchEvent(new Event('input', {bubbles: true}));
box.dispatchEvent(new Event('change', {bubbles: true}));
return 'ok';
}
- Submit and check the result.
This writes the token into the field the form submits; it does not fire
the widget's own callback, so a page that validates through the callback
needs a different approach. sitekey and pageurl must be the ones of
the page the flow is on: the service answers a token for the pair it is
given, and the site rejects it for any other.
Turnstile is solve_turnstile, and its token is valid only from the exit
IP that solved it. That is fine here: Octoparse AI runs on your machine
and the request the token is pasted into leaves from the same machine.
If you would rather not use Python
The token types are two HTTP calls, so the same result comes from Send HTTP Request commands:
POST https://api.dbcapi.me/api/captchawith the account,type=4andtoken_paramsas a JSON string. The id of the solution is in thecaptchafield of the answer (the service may answer303with it in theLocationheader instead).GET https://api.dbcapi.me/api/captcha/{id}untiltextis not empty.
Images are the exception: this command only sends a text body, and the
upload wants a file, so solve_image is the simpler path.
When this is the answer
Octoparse AI solves image CAPTCHAs on its own at $0.0015 an execution,
and the visual scraper's Solve CAPTCHA step costs $1 per thousand
attempts. Use DeathByCaptcha when:
- the challenge is not in their list: reCAPTCHA, Turnstile and the token types are not there;
- one balance serves every tool of the stack instead of one credit pool per product;
- the same solve has to be reproducible outside the tool, in a service or a test.
And only on pages you are allowed to automate.
Next steps
- The block, the guide and the tests: https://github.com/deathbycaptcha/deathbycaptcha-api-client-python
- API documentation: https://deathbycaptcha.com/api

Portuguese
English
Spanish
Russian
Chinese
French
Hindi
Arabic
Bengali
Indonesian
com, 