blob: 63e15d8b1bb2bf7cd6b90bedcf426b4dd46f3ac7 [file] [view] [edit]
# @selenium/manager
Selenium Manager discovers the browsers installed on a machine, downloads the
matching drivers, and prints the paths back as JSON. It is the component the
Selenium bindings already shell out to; this package publishes it on its own so
it can be used without installing a binding.
## Running it
No install needed:
```sh
npx @selenium/manager --browser chrome
```
Or install it:
```sh
npm install @selenium/manager
npx selenium-manager --browser chrome
```
Pass `--help` for the full command set.
## Platform packages
`@selenium/manager` carries no binary itself. It declares one optional
dependency per platform, and npm installs only the one that matches the machine:
| Platform | Package |
| -------------------------- | -------------------------------- |
| Linux x64 | `@selenium/manager-linux-x64` |
| Linux arm64 | `@selenium/manager-linux-arm64` |
| macOS (Intel and Apple Si) | `@selenium/manager-darwin` |
| Windows (x86, x64, arm64) | `@selenium/manager-win32-ia32` |
The architecture in a package name is the binary's, not the machine's, which is
why one package answers every Windows platform: that binary is ia32, and Windows
runs it on x64 and arm64 as well. macOS needs no suffix because its binary is
universal.
## Using it from Node
`binaryPath()` resolves the binary without launching it, for callers that want
to run it themselves:
```js
const { binaryPath } = require('@selenium/manager')
const { execFileSync } = require('node:child_process')
execFileSync(binaryPath(), ['--browser', 'chrome', '--output', 'json'])
```
Setting `SE_MANAGER_PATH` overrides the resolved path, the same way it does in
every Selenium binding.
## Usage statistics
Selenium Manager can report anonymous usage statistics. When it is launched
through this package (`selenium-manager` or `npx @selenium/manager`) they are
opt-in: the launcher sets `SE_AVOID_STATS=true` unless you have set it yourself.
Set `SE_AVOID_STATS=false`, or `avoid-stats = false` in `se-config.toml`, to
send them. Callers that run `binaryPath()` themselves make that choice through
the same variable.
## Links
- Source: https://github.com/SeleniumHQ/selenium/tree/trunk/javascript/selenium-manager
- Documentation: https://www.selenium.dev/documentation/selenium_manager
- Issues: https://github.com/SeleniumHQ/selenium/issues