Skip to main content

Module frame

Module frame 

Source
Expand description

Cross-origin iframe evaluation helpers.

CAPTCHA providers (reCAPTCHA, hCaptcha, Turnstile) render their challenges inside sandboxed cross-origin iframes. JavaScript running in the parent page cannot pierce these iframes via contentDocument or contentWindow.document — doing so throws a SecurityError.

This module uses the Chrome DevTools Protocol to evaluate expressions in each frame’s own execution context, which works regardless of origin.

Functions§

evaluate_in_all_frames
Evaluate expression in every frame of the page (main document + all iframes) and return the deserialized results from every frame that produced a valid value.
evaluate_in_frames_first
Evaluate expression in every frame and return the first result that passes filter. If no frame produces a matching result, default is returned.
find_element_centre_in_frames
Search every frame for a DOM element matching selector and return its bounding-box centre coordinates relative to the main viewport.
verify_token_in_frames
Check whether a CAPTCHA response token exists in any frame. Used for post-solve verification when the provider may inject the token into a hidden input in the main document or inside an iframe.