Installs and locates the Playwright driver: a pinned playwright-core npm package plus
the pinned Node.js binary for the host platform. No Node.js is needed beforehand.
Mirrors playwright-python (scripts/build_driver.py, _impl/_driver.py), except that
Python assembles the bundle at wheel-build time and we do it lazily on the user's machine.
Layout (same as Python's playwright/driver/):
<cache_dir>/<driver_version>/<platform>/
node | node.exe Node.js binary
LICENSE Node.js license
package/ playwright-core npm package (package/cli.js is the entry point)cache_dir defaults to :filename.basedir(:user_cache, "playwright_ex"), overridable with
the :cache_dir option or PLAYWRIGHT_EX_CACHE_DIR.
Overrides (no download happens when one is set):
executable: path/PLAYWRIGHT_EX_EXECUTABLE- an npm-managedplaywrightCLI (e.g.node_modules/.bin/playwright), run aspath run-driver.node: path/PLAYWRIGHT_NODEJS_PATH- like Python: use this Node binary with the cachedpackage/cli.js(the package is still installed if missing).
Summary
Types
An option, overriding its environment variable (see the module docs). :platform (nodejs.org
naming, "linux-x64") installs or locates the driver of another platform than the host's.
Functions
The cache directory: the :cache_dir option, else PLAYWRIGHT_EX_CACHE_DIR, else the user cache
directory (:filename.basedir(:user_cache, "playwright_ex")).
Installs the driver unless it is installed or an override is set (install/1), then returns
executable/1. PlaywrightEx.Supervisor calls it when it starts.
The driver command: {program, args_prefix}, to which run-driver, install ... etc. are
appended. Doesn't install, see ensure_installed/1.
Downloads, verifies and extracts the driver. Idempotent; atomic (everything happens in a temp dir next to the target, which is renamed into place only after all checks passed).
Installs browsers with the driver's own Node, like python -m playwright install ...
(which forwards its argv to node cli.js). No args installs its default browsers, as
npx playwright install. Browsers land in Playwright's usual
location (PLAYWRIGHT_BROWSERS_PATH, default ~/Library/Caches/ms-playwright etc). The
output goes to stdout; a failed install returns the CLI's exit status.
Where the pinned driver is (or will be) installed: <cache_dir>/<version>/<platform>.
Whether the pinned driver is installed in install_dir/1.
The pinned Node.js version the driver runs on (unless :node or :executable is set).
The pinned Playwright version (playwright-core on npm), which the driver runs.
Types
Functions
The cache directory: the :cache_dir option, else PLAYWRIGHT_EX_CACHE_DIR, else the user cache
directory (:filename.basedir(:user_cache, "playwright_ex")).
Installs the driver unless it is installed or an override is set (install/1), then returns
executable/1. PlaywrightEx.Supervisor calls it when it starts.
The driver command: {program, args_prefix}, to which run-driver, install ... etc. are
appended. Doesn't install, see ensure_installed/1.
Downloads, verifies and extracts the driver. Idempotent; atomic (everything happens in a temp dir next to the target, which is renamed into place only after all checks passed).
Options: :cache_dir, :platform, force: true to reinstall. Raises if a download or a
checksum fails.
@spec install_browsers([String.t()], [option()]) :: :ok | {:error, {:exit_status, non_neg_integer()}}
Installs browsers with the driver's own Node, like python -m playwright install ...
(which forwards its argv to node cli.js). No args installs its default browsers, as
npx playwright install. Browsers land in Playwright's usual
location (PLAYWRIGHT_BROWSERS_PATH, default ~/Library/Caches/ms-playwright etc). The
output goes to stdout; a failed install returns the CLI's exit status.
Where the pinned driver is (or will be) installed: <cache_dir>/<version>/<platform>.
Whether the pinned driver is installed in install_dir/1.
@spec node_version() :: String.t()
The pinned Node.js version the driver runs on (unless :node or :executable is set).
@spec version() :: String.t()
The pinned Playwright version (playwright-core on npm), which the driver runs.