Skip to main content

find_tiles_in_frames

Function find_tiles_in_frames 

Source
pub async fn find_tiles_in_frames(
    page: &Page,
    selector: &str,
) -> Result<Vec<FrameTile>>
Expand description

Locate all elements matching selector and return their bounding boxes in main-viewport coordinates, taking the matches from the FIRST frame that contains any.

This is the grid-aware sibling of find_element_centre_in_frames: image CAPTCHAs (reCAPTCHA v2 image grid, hCaptcha) render their tile table inside a cross-origin OOPIF (google.com/recaptcha/api2/bframe, *.hcaptcha.com). Parent-page JS cannot see those tiles at all, and a synthetic el.dispatchEvent(new MouseEvent('click')) would be isTrusted === false even if it could. By returning every tile’s viewport-relative rect, the caller can drive a TRUSTED Page::click_at/Page::click_at_in at the exact centre of any tile the only click a modern image CAPTCHA accepts.

Returns an empty Vec when no frame contains a match. Within the winning frame, tiles are returned in document order with stable index values, so tiles[i].index == i.