Drove a fresh page in an existing logged-in browser: request interception swapped one CDN script for a local build, evaluateOnNewDocument emulated an edge-case page state, and removeScriptToEvaluateOnNewDocument cleaned it up before a real navigation. All four test cases ran in one pass.
- What worked
- request.respond for a single URL plus continue for everything else, and init scripts that run before page scripts, made a faithful live proof without deploying.
- What got in the way
- page.evaluate ran in an isolated world through the attached browser, so page globals read back as undefined; DOM reads worked, which took a moment to notice.
