<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tom Hargreaves</title>
    <description>The latest articles on DEV Community by Tom Hargreaves (@tomhargreaves).</description>
    <link>https://dev.to/tomhargreaves</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4138641%2F8eecf814-9425-4ff2-8150-59f2cf223b0a.png</url>
      <title>DEV Community: Tom Hargreaves</title>
      <link>https://dev.to/tomhargreaves</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tomhargreaves"/>
    <language>en</language>
    <item>
      <title>A recaptcha test that proves something, and the ones that only go green</title>
      <dc:creator>Tom Hargreaves</dc:creator>
      <pubDate>Sun, 15 Nov 2026 23:43:59 +0000</pubDate>
      <link>https://dev.to/tomhargreaves/a-recaptcha-test-that-proves-something-and-the-ones-that-only-go-green-2mpl</link>
      <guid>https://dev.to/tomhargreaves/a-recaptcha-test-that-proves-something-and-the-ones-that-only-go-green-2mpl</guid>
      <description>&lt;p&gt;Most reCAPTCHA problems I get asked about turn out not to be captcha problems. They are tests that pass for the wrong reason: a green pipeline, a production form that keeps rejecting real people, and nobody able to say which of the two changed. Separating the two is mostly a matter of deciding what you actually mean by a recaptcha test.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three different things people call "testing the captcha"
&lt;/h2&gt;

&lt;p&gt;When someone says their suite covers the captcha, it is usually one of these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The widget renders. The &lt;code&gt;g-recaptcha&lt;/code&gt; element exists, the iframe loads, &lt;code&gt;grecaptcha.render&lt;/code&gt; did not throw. Runs in milliseconds, works offline, says nothing about your backend.&lt;/li&gt;
&lt;li&gt;Verification works. Your server posts whatever token it received to Google's siteverify endpoint and branches on &lt;code&gt;success&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The whole flow works for a person. A real challenge was shown, a real token was minted, the form submitted, and a row landed in the database.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Levels 1 and 2 belong on every commit. Level 3 belongs in a release check, run once and on purpose. Mixing them is how a suite turns green while the signup form stays broken.&lt;/p&gt;

&lt;h2&gt;
  
  
  Google's v2 test keys, and why the warning banner matters
&lt;/h2&gt;

&lt;p&gt;For reCAPTCHA v2, Google's FAQ publishes a fixed pair: site key &lt;code&gt;6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI&lt;/code&gt; and secret &lt;code&gt;6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe&lt;/code&gt;. The wording on that page is blunt — you will always get "No CAPTCHA" and all verification requests will pass. No grid, no checkbox click, no waiting.&lt;/p&gt;

&lt;p&gt;The part people skip: the widget renders a warning banner while those keys are in use. That banner is not an inconvenience, it is the safety mechanism. It makes a test key on a live page visible to anyone who looks, which is what you want, because a test key in production waves every bot straight through.&lt;/p&gt;

&lt;p&gt;Two practical consequences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Both sides have to be swapped together. A test site key in the browser and your production secret on the server is not "mostly configured" — verification still fails, and the failure looks like a token problem rather than a configuration problem.&lt;/li&gt;
&lt;li&gt;A staging domain does not need to be in the key's allowlist when the test key is used, which is why these keys are the standard answer for localhost. &lt;code&gt;localhost&lt;/code&gt; is not in a normal key's supported domain list by default; you have to add it explicitly in the admin console, and Google recommends not doing that on the production key at all.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  reCAPTCHA v3 has no test keys, so stop asserting the score
&lt;/h2&gt;

&lt;p&gt;There is no always-pass v3 key. Google's guidance is to create a separate key for test environments and to expect the scores not to be accurate, because v3 scoring depends on seeing real traffic. That is not a documentation gap, it is the design: a score is a statement about the traffic, and CI traffic is one machine in one datacenter.&lt;/p&gt;

&lt;p&gt;So an assertion like &lt;code&gt;expect(score).toBeGreaterThan(0.5)&lt;/code&gt; is a measurement of your runner's IP reputation, not of your product. Assert the parts that are actually deterministic instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a token value appears in the hidden field inside your timeout;&lt;/li&gt;
&lt;li&gt;siteverify returns &lt;code&gt;success: true&lt;/code&gt; for that value;&lt;/li&gt;
&lt;li&gt;your form rejects a request where the field is empty or missing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A v3 token also lives about two minutes and can only be verified once. Any test that renders the page, waits, and then submits is exercising the expiry path whether it means to or not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turnstile is the provider that does this properly
&lt;/h2&gt;

&lt;p&gt;If you have a choice of provider, Cloudflare's dummy keys are worth knowing, because they cover the failure paths and not just the happy one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;1x00000000000000000000AA&lt;/code&gt; — always passes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;2x00000000000000000000AB&lt;/code&gt; — always fails&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;3x00000000000000000000FF&lt;/code&gt; — forces the interactive challenge&lt;/li&gt;
&lt;li&gt;secret &lt;code&gt;1x0000000000000000000000000000000AA&lt;/code&gt; — always passes validation&lt;/li&gt;
&lt;li&gt;secret &lt;code&gt;3x0000000000000000000000000000000AA&lt;/code&gt; — returns the token-already-spent error&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two rules come with them. The dummy token is only accepted by the dummy secrets, so client and server keys get swapped as a pair. And the dummy keys work on localhost, which production keys deliberately do not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cheap tests you should write first
&lt;/h2&gt;

&lt;p&gt;Before anything that mints a token, write the negative tests. They need no keys, no network to a solver, and they catch the mistakes that actually hurt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;POST the protected endpoint with no token field at all — expect your own 400, not a 500 and not a success.&lt;/li&gt;
&lt;li&gt;POST with an empty string for the same field — same expectation.&lt;/li&gt;
&lt;li&gt;POST the same token twice. Google's siteverify answers a second attempt with &lt;code&gt;success: false&lt;/code&gt; and &lt;code&gt;timeout-or-duplicate&lt;/code&gt; in &lt;code&gt;error-codes&lt;/code&gt;, because a token can only be checked once. If your code turns that into a generic 500, users will read it as a broken form.&lt;/li&gt;
&lt;li&gt;Wait past the token lifetime and submit. On a v2 checkbox the code expires after roughly two minutes and the widget flips back so the user has to tick again — your page should say something, not spin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these need a captcha provider, and together they cover the majority of real incidents I have seen reported.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where stubs stop being enough
&lt;/h2&gt;

&lt;p&gt;Nothing above touches the parts that break in production: the domain missing from the key, invisible v3 running on page load so the token is stale by submit time, a widget sitting inside a third-party iframe where &lt;code&gt;querySelector&lt;/code&gt; cannot reach it, or a bot-detection layer on your own egress IP blocking the whole flow.&lt;/p&gt;

&lt;p&gt;For one deliberate run per release you want a genuine token. That is where a &lt;a href="https://fuckcaptcha.top/" rel="noopener noreferrer"&gt;recaptcha test&lt;/a&gt; leaves the realm of stubs and needs something that can complete the challenge outside the browser — an API your test runner calls, or your staging server calls, whichever fits the architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a token request wants
&lt;/h3&gt;

&lt;p&gt;The request is small, and every field is there because leaving it out lowers the pass rate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sitekey&lt;/code&gt; — required, the &lt;code&gt;data-sitekey&lt;/code&gt; from the page&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;url&lt;/code&gt; — required, and it has to be the real page URL, not &lt;code&gt;about:blank&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useragent&lt;/code&gt; — recommended, and worth keeping identical to the browser the flow normally uses&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data&lt;/code&gt; — extra parameters for the specific type, for example reCAPTCHA v3's &lt;code&gt;action&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;enterprise&lt;/code&gt; — set when the target site runs Enterprise&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Submitting returns a job id, the job runs in the background, and you poll it. The type name is part of the path and has to be spelled exactly right — a typo does not come back as an unknown-type error, it comes back as a generic failure, which is a genuinely annoying twenty minutes to debug.&lt;/p&gt;

&lt;h3&gt;
  
  
  The plumbing rules that decide whether the test is stable
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;error: 14&lt;/code&gt; means the job is unfinished. It is not a failure and it costs nothing extra. Poll again — every 2 to 3 seconds for token jobs, not tighter. Resubmitting because you saw a 14 leaves several jobs racing, which is slower and billed.&lt;/li&gt;
&lt;li&gt;A rejected submit (bad parameter, no credit, no upstream capacity) costs nothing. Credits are deducted the moment the upstream accepts a job, and stay deducted whatever happens afterwards, timeouts included. There are no refunds, so a test that resubmits in a loop is a test that spends money.&lt;/li&gt;
&lt;li&gt;Jobs expire: recognition jobs after 3 minutes, token jobs after 5. The token they hand back is good for roughly a minute or two — use it immediately, never cache it between runs or between parallel workers.&lt;/li&gt;
&lt;li&gt;Default concurrency is 4 and the per-key rate ceiling is 20 requests per second. Both overflows come back as &lt;code&gt;error: 11&lt;/code&gt;. In a CI matrix that runs specs in parallel, this is the first thing to fail, and it fails intermittently, which is the worst way to fail.&lt;/li&gt;
&lt;li&gt;Quota resets daily at midnight Beijing time (UTC+8) and does not roll over.&lt;/li&gt;
&lt;li&gt;Almost every error arrives with HTTP 200. Branch on the &lt;code&gt;error&lt;/code&gt; field, never on the status code — only 401, 405 and 404 break that pattern.&lt;/li&gt;
&lt;li&gt;Authentication is a header, &lt;code&gt;Authorization: Basic nsk_...&lt;/code&gt;, and the key goes in verbatim. It is deliberately not base64, so encoding it makes it unrecognisable.&lt;/li&gt;
&lt;li&gt;A balance check is a good first assertion in a smoke test: the status endpoint returns remaining credit, the reset countdown and the concurrency limit in one call.&lt;/li&gt;
&lt;li&gt;Python's stdlib &lt;code&gt;urllib&lt;/code&gt; gets 403'd by the front-end CDN with an empty response body. Use &lt;code&gt;requests&lt;/code&gt;, or give &lt;code&gt;urllib&lt;/code&gt; a normal User-Agent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cost shape
&lt;/h3&gt;

&lt;p&gt;The two entry points are priced differently, and it is worth picking the cheap one when the test allows it. Solving the image and clicking the tiles yourself is one credit; asking for a finished reCAPTCHA v2 token is twenty. If a test only needs to prove the token wiring works end to end, a one-credit text captcha proves the same plumbing at a twentieth of the cost. Signup includes 200 free credits, which is more than enough to build the fixture before you pay anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Test keys on every commit. Negative tests for the failure paths. One real, deliberate token run before you ship, with the URL, sitekey and user agent copied from production rather than invented. And one rule about scores: never assert them, because they are not about your code.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>security</category>
      <category>testing</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A reCAPTCHA v3 token belongs to one page, not to your script</title>
      <dc:creator>Tom Hargreaves</dc:creator>
      <pubDate>Wed, 11 Nov 2026 21:26:02 +0000</pubDate>
      <link>https://dev.to/tomhargreaves/a-recaptcha-v3-token-belongs-to-one-page-not-to-your-script-4cci</link>
      <guid>https://dev.to/tomhargreaves/a-recaptcha-v3-token-belongs-to-one-page-not-to-your-script-4cci</guid>
      <description>&lt;h2&gt;
  
  
  A reCAPTCHA v3 token belongs to one page, not to your script
&lt;/h2&gt;

&lt;p&gt;Nothing about v3 happens in the browser, so none of the usual failures show up there either. There is no image to collect and no grid to click. The only thing you get back is a string, and that string is minted against a specific sitekey, a specific page URL and a specific action. The target site's backend checks those before it looks at anything else. A token that looks fine in your log can be thrown away two seconds later on the other side, with nothing in your own process to show for it.&lt;/p&gt;

&lt;p&gt;So the productive question is not how good the solver is. It is whether the request that minted the token described the target page correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The field list for a token job
&lt;/h2&gt;

&lt;p&gt;A v3 token is minted with &lt;code&gt;POST /v1/token/recaptcha3&lt;/code&gt;. The body is short, and every field in it matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sitekey&lt;/code&gt; — required. The value of the &lt;code&gt;data-sitekey&lt;/code&gt; attribute on the page you are working against.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;url&lt;/code&gt; — required. The docs are blunt about it: it must match the real page.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useragent&lt;/code&gt; — recommended, and not cosmetic. It noticeably improves the pass rate.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data&lt;/code&gt; — the extra-parameters blob. For v3 the &lt;code&gt;action&lt;/code&gt; goes in here, not at the top level.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;enterprise&lt;/code&gt; — send &lt;code&gt;true&lt;/code&gt; only when the target is on reCAPTCHA Enterprise.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;proxy&lt;/code&gt; — pins the egress IP. The service expects an object carrying scheme, host, port, username and password.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;type&lt;/code&gt; — only needed when the path does not carry the type.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The url is not a formality
&lt;/h3&gt;

&lt;p&gt;If the widget renders on a checkout page, that is the URL to pass — not the home page, and not the login page where your session started. The sitekey and the URL have to belong to the same property; a sitekey borrowed from one site with the URL of another gives the verifier no reason to accept the result.&lt;/p&gt;

&lt;h3&gt;
  
  
  The useragent has to survive the handoff
&lt;/h3&gt;

&lt;p&gt;Send nothing and the request goes out under the solver's own default UA. Later, your headless browser pastes the token into a form and the backend sees the UA of that browser instead. Grab the UA once from the client that will actually submit the token, keep it in one constant, and pass the same string on every mint.&lt;/p&gt;

&lt;h3&gt;
  
  
  action goes inside data
&lt;/h3&gt;

&lt;p&gt;Call sites are registered per action name. If the target verifies against an expected action, a v3 token minted with nothing in &lt;code&gt;data.action&lt;/code&gt; will not line up with it. Flipping &lt;code&gt;enterprise&lt;/code&gt; on is the same kind of mistake in reverse: only set it when the target's front end loads the Enterprise script.&lt;/p&gt;

&lt;h2&gt;
  
  
  There is no recognition path for v3
&lt;/h2&gt;

&lt;p&gt;The service exposes two entry points and they return different things. &lt;code&gt;/v1/recognition/&amp;lt;type&amp;gt;&lt;/code&gt; takes &lt;code&gt;image_data&lt;/code&gt; and answers with tiles to click or text to type. &lt;code&gt;/v1/token/&amp;lt;type&amp;gt;&lt;/code&gt; takes a sitekey and a URL and answers with something submittable. The pricing table lists &lt;code&gt;recaptcha&lt;/code&gt; (image selection) under recognition and &lt;code&gt;recaptcha3&lt;/code&gt; under tokens — v3 has no image, so only the second one applies.&lt;/p&gt;

&lt;p&gt;If you would rather not maintain the parameter dance yourself, the same &lt;a href="https://fuckcaptcha.top/" rel="noopener noreferrer"&gt;recaptcha v3&lt;/a&gt; flow is what the browser extension drives: you hand it the key, it calls the recognition side and does its own clicking. Driving it from a script means passing sitekey, url and useragent, then spending the token immediately, because it is minted for a session that is already running out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Poll, do not stampede
&lt;/h2&gt;

&lt;p&gt;Submitting returns a job id: &lt;code&gt;{"data":"nsj_…"}&lt;/code&gt;. You then poll &lt;code&gt;GET /v1/token/recaptcha3?id=…&lt;/code&gt;. While the job is working you get &lt;code&gt;{"error":14,"message":"Incomplete job"}&lt;/code&gt;. That is not a failure, it costs nothing extra, and it is not a reason to submit again. Token jobs are slow — the docs put a measured hCaptcha token at roughly a minute and say to poll every 2–3 seconds, not faster.&lt;/p&gt;

&lt;p&gt;The billing rule is what makes blind retries expensive: a rejected submit (bad parameters, no credit, no upstream capacity) is free, but the moment the upstream accepts the job the credits are gone for good, including when it eventually times out. No refunds. A retry loop that fires on every &lt;code&gt;14&lt;/code&gt; pays two, three, four times for one challenge and runs slower, because the jobs compete with each other.&lt;/p&gt;

&lt;p&gt;Token jobs keep their id for 5 minutes; recognition jobs only get 3. Past that the job is void and the only move left is a fresh submit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Errors that do not arrive as errors
&lt;/h2&gt;

&lt;p&gt;Nearly every failure here comes back with a status code of 200, so branching on the status is a bug. Read the &lt;code&gt;error&lt;/code&gt; field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;10&lt;/code&gt; — invalid request: missing field, wrong method, wrong path. Retrying changes nothing.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;11&lt;/code&gt; — rate or concurrency limit. The default ceiling is 4 parallel jobs and 20 requests per second per key.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;13&lt;/code&gt; — the job id is unknown or belongs to a different key.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;15&lt;/code&gt; — the key is wrong or revoked.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;16&lt;/code&gt; — no credit left. Quota refills at midnight Beijing time and does not accumulate.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;9&lt;/code&gt; — everything the upstream does not want you to handle separately, including an accepted job that failed or timed out, and an unavailable type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A misspelled type is worth calling out, because &lt;code&gt;recaptcha3&lt;/code&gt; and &lt;code&gt;recaptcha2&lt;/code&gt; differ by one character, and a typo is forwarded upstream and comes back as &lt;code&gt;9&lt;/code&gt;, which reads like a capacity problem.&lt;/p&gt;

&lt;p&gt;Two more things that bite in practice. Python's stdlib &lt;code&gt;urllib&lt;/code&gt; is refused by the CDN as a bot, so a plain urllib client sees a failure that has nothing to do with the service — use &lt;code&gt;requests&lt;/code&gt;, or give urllib a normal User-Agent header. And the key is not base64: &lt;code&gt;Authorization: Basic nsk_YOUR_KEY&lt;/code&gt; takes the raw key right after &lt;code&gt;Basic&lt;/code&gt;. Encoding it makes it unrecognisable.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GET /v1/status/&lt;/code&gt; is the cheap sanity check before a run: it returns the remaining credit, the plan's allowance, the seconds until the next reset and the concurrency limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  A mint-and-poll cycle
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="no"&gt;BASE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"{base}"&lt;/span&gt;
&lt;span class="no"&gt;KEY&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"nsk_YOUR_KEY"&lt;/span&gt;
&lt;span class="no"&gt;AUTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Basic {KEY}"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;mint_v3&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sitekey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;page_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ua&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{BASE}/v1/token/recaptcha3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="no"&gt;AUTH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"sitekey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sitekey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;page_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"useragent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ua&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;# rejected on submit: nothing charged&lt;/span&gt;

    &lt;span class="n"&gt;deadline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;2.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{BASE}/v1/token/recaptcha3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;AUTH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;       &lt;span class="c1"&gt;# still working, keep waiting&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;               &lt;span class="c1"&gt;# accepted then failed: charged&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;TimeoutError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What to check before blaming the solver
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Is the &lt;code&gt;sitekey&lt;/code&gt; the one on the page that actually renders the widget?&lt;/li&gt;
&lt;li&gt;Is &lt;code&gt;url&lt;/code&gt; that same page, including the path?&lt;/li&gt;
&lt;li&gt;Is &lt;code&gt;useragent&lt;/code&gt; the UA of the browser that will submit the token?&lt;/li&gt;
&lt;li&gt;Does &lt;code&gt;data.action&lt;/code&gt; match the action the call site was registered with?&lt;/li&gt;
&lt;li&gt;Are you polling every 2–3 seconds instead of resubmitting?&lt;/li&gt;
&lt;li&gt;Is there credit left and is concurrency under 4?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Get those six right and the token usually survives. Get one wrong and you will spend an afternoon tuning a solver that was never the problem.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>hcaptcha bypass in a real pipeline: what actually decides whether it works</title>
      <dc:creator>Tom Hargreaves</dc:creator>
      <pubDate>Thu, 01 Oct 2026 08:58:48 +0000</pubDate>
      <link>https://dev.to/tomhargreaves/hcaptcha-bypass-in-a-real-pipeline-what-actually-decides-whether-it-works-24nm</link>
      <guid>https://dev.to/tomhargreaves/hcaptcha-bypass-in-a-real-pipeline-what-actually-decides-whether-it-works-24nm</guid>
      <description>&lt;p&gt;People search for &lt;strong&gt;hcaptcha bypass&lt;/strong&gt; expecting a single technique. What they actually need depends on something they usually have not checked yet: &lt;strong&gt;where the challenge lives and what shape the answer takes.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I have automated hCaptcha on and off for a couple of years, in scrapers and in browser flows. Every time it went badly, the model was not the problem. The setup was. Here is the version of the advice I wish I had read first.&lt;/p&gt;

&lt;h2&gt;
  
  
  First: there are three hCaptcha shapes, not one
&lt;/h2&gt;

&lt;p&gt;hCaptcha does not present one kind of task. Depending on what the site owner configured, you may get:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A checkbox.&lt;/strong&gt; No image at all in the normal case. You click, and it either passes or escalates. There is nothing to read and nothing to solve locally — the decision was made by a score, server-side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A tile grid.&lt;/strong&gt; The familiar 3x3 (sometimes 4x4) "please click each image containing a boat". This is the only shape where image recognition is the point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A drag task.&lt;/strong&gt; A generated object that has to be dragged somewhere. The answer here is &lt;strong&gt;a coordinate pair, not a text answer&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each of those needs a different response, and the most expensive mistake in this space is treating a checkbox like a puzzle. If a site is showing you a checkbox, there is no picture to send anywhere. There is only a session that either looks plausible or does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule that confuses everyone: billing and "not ready"
&lt;/h2&gt;

&lt;p&gt;Because hCaptcha work is asynchronous — you submit, then you poll — you have to understand the error vocabulary before you write the loop. On the service I use, three facts do the heavy lifting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Not finished yet" has its own code.&lt;/strong&gt; It is a normal step in the happy path. If your client treats every error as a failure, your first naive version will resubmit a job that is already running and already paid for. One image becomes several jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You are billed when the upstream accepts the job, not when it succeeds.&lt;/strong&gt; A rejected submit — bad parameters, no credit, no upstream capacity — costs nothing. Once accepted, the credits are spent regardless of the outcome, including a timeout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There are no refunds, including on timeouts.&lt;/strong&gt; So your true cost is per &lt;em&gt;attempt&lt;/em&gt;, not per &lt;em&gt;successful solve&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The practical consequence is that "retry on error" is a dangerous default here. I had to split error handling into three branches — wait, slow down, and genuine failure — before my numbers stopped drifting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing between recognition and a token
&lt;/h2&gt;

&lt;p&gt;If you need an hCaptcha answer, there are two entry points and they solve different problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image recognition&lt;/strong&gt; — you already have the picture; it tells you which tiles to click or where to drag. You do the clicking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token generation&lt;/strong&gt; — you do not have the picture, or do not care; the whole challenge is solved server-side and you get back something submittable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are priced differently, and not by a rounding error: on the service I use an hCaptcha &lt;strong&gt;token costs 10 credits where a recognition call costs 1&lt;/strong&gt;. If your browser flow still has to tick the checkbox itself, you want recognition — it returns an acknowledgement rather than a token, and costs correspondingly less.&lt;/p&gt;

&lt;h2&gt;
  
  
  The details that only show up in production
&lt;/h2&gt;

&lt;p&gt;These each cost me more than an hour:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drag answers come back as percentages.&lt;/strong&gt; Top-left is &lt;code&gt;0,0&lt;/code&gt;, bottom-right is &lt;code&gt;100,100&lt;/code&gt;. Multiply by the real image width and height. I spent a while feeding percentages into a mouse move as if they were pixels and wondering why every drag landed in the corner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Token challenges are slow.&lt;/strong&gt; A measured hCaptcha token takes about a minute, and longer at peak. That is why token jobs get a longer expiry than recognition jobs — five minutes against three. Poll every 2-3 seconds, not faster: every accepted job is billed, so hammering the endpoint just pays twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concurrency, not model quality, is your throughput ceiling.&lt;/strong&gt; If the limit is 4 parallel jobs and a job takes about a minute, your realistic ceiling is about 4 per minute no matter how good the model is. Compute that number before you design the queue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A checkbox result is not a solved captcha.&lt;/strong&gt; If you get back an acknowledgement, you still have to place it where the page expects and let the site's own callback fire. Injecting a value into the wrong field looks identical to a failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  When it fails, check these before blaming the solver
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Is the task even enabled on your plan?&lt;/strong&gt; Some types sit behind higher tiers, and you only find out after paying.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Did you send the challenge text and the page context?&lt;/strong&gt; For tile selection, sending the question text improves accuracy noticeably, and for hCaptcha specifically the &lt;code&gt;data&lt;/code&gt; object scraped from the page should be passed through unchanged — it carries the link between the question and the images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is your user agent consistent with the page you are solving for?&lt;/strong&gt; For token types this is the single biggest lever, and it is free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Are you measuring per attempt or per success?&lt;/strong&gt; If failed-but-accepted jobs are billed, your real unit cost is the former, and retry loops hide the difference.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;hCaptcha is three problems wearing one name. Figure out which shape you actually have, read the billing rule before writing any retry logic, and remember that the number that decides your throughput is the concurrency ceiling, not how clever the model is.&lt;/p&gt;

&lt;p&gt;I maintain the service this is measured against — the full error table, the endpoint list, the twelve supported types and the exact billing rule are on the front page at &lt;a href="https://fuckcaptcha.top/" rel="noopener noreferrer"&gt;hcaptcha bypass&lt;/a&gt;. The figures above are the ones I operate, not ones from a marketing page.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>security</category>
      <category>webscraping</category>
    </item>
    <item>
      <title>The captcha widget is not in your page (and that changes everything)</title>
      <dc:creator>Tom Hargreaves</dc:creator>
      <pubDate>Wed, 23 Sep 2026 04:44:10 +0000</pubDate>
      <link>https://dev.to/tomhargreaves/the-captcha-widget-is-not-in-your-page-and-that-changes-everything-b9b</link>
      <guid>https://dev.to/tomhargreaves/the-captcha-widget-is-not-in-your-page-and-that-changes-everything-b9b</guid>
      <description>&lt;h1&gt;
  
  
  The captcha widget is not in your page (and that changes everything)
&lt;/h1&gt;

&lt;p&gt;Here is a thing I got wrong for longer than I want to admit. I had a scraper that needed to tick a captcha checkbox, and I spent an evening trying to &lt;code&gt;querySelector&lt;/code&gt; my way to it. The checkbox exists. I could see it on screen. I could even click it with a mouse. I just could not reach it from JavaScript, and the error was not helpful because there was no error.&lt;/p&gt;

&lt;p&gt;The reason is boring once you know it: &lt;strong&gt;the checkbox is not in your document.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Nearly every captcha is a third-party iframe
&lt;/h2&gt;

&lt;p&gt;When a site embeds reCAPTCHA, hCaptcha, Cloudflare Turnstile, or FunCaptcha, what actually lands in the page is usually a small &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; pointed at the vendor's domain. The widget renders inside that iframe, in a document that belongs to someone else.&lt;/p&gt;

&lt;p&gt;That is not an implementation detail you can route around. It is the same-origin policy working exactly as designed, and it has consequences that only show up when you try to automate:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;document.querySelector&lt;/code&gt; will never find the checkbox.&lt;/strong&gt; It is not in your DOM tree. You can find the &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; element itself, and that is where your access stops. This is the single most common reason a script that "works in devtools" does nothing when you run it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS cannot reach inside either.&lt;/strong&gt; Styling that iframe's contents, or hiding the badge, needs the vendor to cooperate. You are looking at a rendered box, not a subtree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anything you compute from &lt;code&gt;getBoundingClientRect()&lt;/code&gt; is a screen rectangle&lt;/strong&gt;, not page structure. Which is still useful — it is how you find where to click — but it tells you nothing about what you are clicking.&lt;/p&gt;

&lt;p&gt;There is a softer variant of the same thing: some sites keep the widget same-origin but render it into a shadow root. Same conclusion, different mechanism. If &lt;code&gt;querySelector&lt;/code&gt; returns null and devtools shows the element, suspect a boundary of this kind before you suspect a race condition.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means for the two ways people automate
&lt;/h2&gt;

&lt;p&gt;Once you accept the boundary, the design space narrows to two shapes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drive a real browser.&lt;/strong&gt; You are not reaching into the iframe's DOM here either, but you do not have to: you click at coordinates. A CDP-level mouse event goes through iframes, shadow roots and cross-origin boundaries, because it is dispatched at the compositor rather than through the page's DOM. This is why coordinate clicking is the default approach for browser automation, and why it keeps working when every DOM-based selector fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Or hand the image to something that specialises in images.&lt;/strong&gt; If you can obtain the pixels, you do not need the DOM at all. That is the whole idea behind the recognition half of a captcha solving API: you send a picture, you get back what to do with it — which tiles to click, which text to type, or where to drag.&lt;/p&gt;

&lt;p&gt;Most of my own automation ends up combining the two: browser for the clicking, an API for the reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that trips people up: getting the pixels
&lt;/h2&gt;

&lt;p&gt;If you go the image route, the hard part is not the model. It is extracting the picture you are actually looking at. I have hit three distinct versions of this and they all look like "the OCR is bad":&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The iframe's default height.&lt;/strong&gt; A cross-origin iframe with no explicit size renders at a default height (150px is the classic value) while the content inside keeps its own layout. Screenshot the iframe element and you get a correctly-sized image of a clipped puzzle. Mine came out 280x150 and I had assumed a 3x3 grid of ~100px tiles, because that is what a vendor demo page looks like.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The tainted canvas.&lt;/strong&gt; Reading pixels back out of a canvas is only permitted if nothing drawn into it came from another origin. Draw a cross-origin image into a canvas without CORS approval and the canvas is &lt;em&gt;tainted&lt;/em&gt;: &lt;code&gt;getImageData()&lt;/code&gt;, &lt;code&gt;toDataURL()&lt;/code&gt; and &lt;code&gt;toBlob()&lt;/code&gt; all throw a &lt;code&gt;SecurityError&lt;/code&gt; instead of returning pixels rather than silently returning nothing (the rule is documented on &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image" rel="noopener noreferrer"&gt;MDN's CORS-enabled image page&lt;/a&gt;). The nasty version of this failure is not the exception. It is the blank capture: right dimensions, plausible file size, no content, and nothing in the logs to say so. Compare a headed run against a headless run — mine only failed headless.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Someone else's challenge.&lt;/strong&gt; This is the one that stung. A test page of mine still had a leftover anti-bot script, so the solver ran happily at 2am and solved a challenge that a third-party script had injected to verify &lt;em&gt;me&lt;/em&gt;. The call succeeded, the answer was correct, and the result went nowhere, because it belonged to a different form. The fix is one line: log the frame URL alongside the challenge type. If the two disagree, you are solving a puzzle that was not yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  A shape that survives all of this
&lt;/h2&gt;

&lt;p&gt;What I do now, and what I would tell anyone starting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Assume every challenge is cross-origin until you check.&lt;/strong&gt; Find the iframe, log its &lt;code&gt;src&lt;/code&gt;, and confirm which vendor you are actually dealing with before writing any solving logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compute click targets from rectangles, not from selectors.&lt;/strong&gt; Take the iframe's bounding box, get your offset from the challenge response, and convert to real pixels. Coordinates that come back from recognition services are typically percentages (0-100) for exactly this reason: the service does not know your image's size, so it tells you the position in a form you can scale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dump the first frame to disk and look at it with your own eyes.&lt;/strong&gt; Not a benchmark — the actual image. This one habit caught two of the three bugs above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distrust a successful call whose result you did not observe being consumed.&lt;/strong&gt; A green checkmark means the API answered, not that the answer was used.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this is about model accuracy. The model was fine the entire time. I was feeding it the wrong picture, or the right picture for the wrong form, and both of those look identical from the outside.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note on the extension route
&lt;/h2&gt;

&lt;p&gt;There is a third option worth knowing about if you do not want to own this pipeline: ship it as a browser extension. The extension runs inside the browser, so it can take the screenshot, do the cropping and inject the result without you writing any of that glue, and the vendor's iframe boundary stops mattering because the extension is not a page script. I maintain a &lt;a href="https://fuckcaptcha.top/download" rel="noopener noreferrer"&gt;captcha solver extension&lt;/a&gt; that handles this for the common challenge types; if you would rather build your own, the four rules above are the parts that cost me the most time.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
