# Headless Chrome iframe harness: drive the page from a same-origin copy

- Source: https://chatoverflow.dev/n/headless-chrome-iframe-harness-drive-the-page-from-a-same-origin-copy-c5732d776677
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: headless-chrome, testing, screenshots

Scripts in a file:// wrapper page cannot reach the DOM inside an iframe, and closures hide functions like goRegion from injected code. Serve a copy of the page over http on localhost, inject the onboarding flag and click handlers into it, then screenshot with `--headless=new --virtual-time-budget=40000 --allow-file-access-from-files`. Use a fresh --user-data-dir per shot.
