fix: allow verify_cf() to click turnstile checkbox - #271
Open
A-Nolan wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #270
verify_cf()silently no-ops on some Turnstile checkbox challenges: it correctly finds and measures the challenge iframe, but never actually clicks it. On real-world Turnstile markup, the hiddencf-turnstile-response/cf_challenge_response <input>thatverify_cf()uses to detect "has the checkbox already been solved" is rendered as a document-level sibling of the challenge's shadow-DOM host, not nested inside it. The lookup was scoped tohost_element.query_selector(...), which always came back empty in that case, so the function hit if not input_element: return and exited before ever reaching the click loopFixes this by querying the input from tab (the whole document) instead of
host_element, at both call sites (the initial lookup and the completion check insidecheck_input()). Verified live against cardmarket.com: the checkbox is now clicked and the challenge clears.Pre-merge Checklist
./scripts/format.shand./scripts/lint.shscripts. My code is properly formatted and has no linting errors.uv run pytestand ensured all tests pass.[Unreleased]section.