Init Scripts & Extensions
Init scripts run before page JavaScript. Use them to install hooks, polyfills, instrumentation, or test helpers before the first navigation.
Launch-time scripts
You can also configure scripts with an environment variable:
Launch-time scripts are applied when the browser starts. If the daemon is already running, close it before changing launch-time script options.
Built-in scripts
react-devtools is the built-in feature currently available. It installs the React DevTools hook before application code runs and is required for react tree, react inspect, react renders, and react suspense.
Runtime scripts
Runtime init scripts are useful after a session has started. They are still init scripts, so they affect future documents and navigations rather than rewriting already-executed page code.
Runtime init-script identifiers are session-wide. removeinitscript removes the script from every open tab where it was registered and prevents it from being replayed into tabs opened later.
Pre-navigation setup
For flows that need routes, cookies, or scripts installed before the first real navigation, start the browser without a URL:
open with no URL launches the browser on about:blank, leaving room to stage state before the target page loads.
Extensions
Extensions are launch-time options. They require a local Chromium-based browser and are not supported with CDP connections, cloud providers, or Lightpanda.
Safety
Init scripts and extensions run with high privilege in the page context. Only load scripts and extension directories from trusted local paths.