Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ pytest -q
- **Token through `execute_script` arguments.** The token is passed as `arguments[0]` instead of being formatted into JavaScript, so long tokens with special characters never corrupt the script. The same call fires `data-callback`, which many forms use to enable the submit button.
- **One browser, one identity.** The User-Agent sent to CapMonster Cloud is read from the running Chrome, which keeps the solved token consistent with the session that submits it.

## reCAPTCHA v2 token basics

- The token is a `g-recaptcha-response` string. Write it into the hidden textarea or pass it to the widget callback.
- reCAPTCHA v2 tokens are single-use and short-lived. Request a new token for every submission and submit right away.
- Pass the same page URL and sitekey that the browser used, otherwise the token can be rejected on validation.

## Common errors

| Symptom | Cause and fix |
Expand All @@ -55,7 +61,7 @@ pytest -q
| `ElementClickInterceptedException` on submit | A cookie banner or overlay covers the button. Close it first or click via `driver.execute_script("arguments[0].click()", el)`. |
| `GetTaskError: [ERROR_KEY_DOES_NOT_EXIST]` / `[ERROR_ZERO_BALANCE]` | Wrong API key or empty balance. |
| `RuntimeError: asyncio.run() cannot be called from a running event loop` | You run the code inside Jupyter or an async app. Use `await client.solve_captcha(...)` there instead of `asyncio.run`. |
| Server says the captcha is invalid | The token is older than ~120 seconds or was submitted twice. Submit right after injection. |
| Server says the captcha is invalid | The token expired (it is short-lived, roughly one to two minutes) or was submitted twice. Submit right after injection. |
| Two textareas filled, form still fails | The page has several widgets with different sitekeys. Solve the one inside the form you submit. |

## Get an API key
Expand Down
Loading