Skip to content

docs: clarify stealth init script visibility#353

Open
mturac wants to merge 3 commits into
D4Vinci:mainfrom
mturac:fix/issue-350-init-script-page-action
Open

docs: clarify stealth init script visibility#353
mturac wants to merge 3 commits into
D4Vinci:mainfrom
mturac:fix/issue-350-init-script-page-action

Conversation

@mturac

@mturac mturac commented Jun 14, 2026

Copy link
Copy Markdown

Summary

  • clarify how init_script interacts with Patchright's isolated execution context in Stealthy mode
  • point page_action users to page.evaluate(..., isolated_context=False) when they need to read globals placed on window
  • keep the existing runtime behavior unchanged

Refs #350

Tests

  • git diff --check origin/main...HEAD

@yetval

yetval commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Thanks for this. I think this is patchright working as intended rather than a bug, since the init script does run, it just sits in the isolated world so your evaluate calls can't see it. Anyone who needs it in the main world can already pass isolated_context=False. My honest take is this doesn't really need a code change and a short docs note would cover it, but happy to be wrong.

@mturac mturac changed the title fix: make stealth init scripts available to page actions docs: clarify stealth init script visibility Jun 14, 2026
@mturac

mturac commented Jun 14, 2026

Copy link
Copy Markdown
Author

Good point, thanks for the context. I replaced the runtime change with a docs-only note that keeps the existing behavior intact and points page_action users to page.evaluate(..., isolated_context=False) when they need to read globals from the page main world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants