2023-04-06 12:23:10 +00:00
---
sidebar_label: API
---
2023-04-11 12:47:25 +00:00
# @puppeteer/browsers
Manage and launch browsers/drivers from a CLI or programmatically.
## CLI
Use `npx` to run the CLI:
2023-04-26 09:32:33 +00:00
```bash
2023-04-11 12:47:25 +00:00
npx @puppeteer/browsers --help
```
2024-04-05 12:03:40 +00:00
Built-in per-command `help` will provide all documentation you need to use the CLI.
2023-04-11 12:47:25 +00:00
2023-04-26 09:32:33 +00:00
```bash
2023-04-11 12:47:25 +00:00
npx @puppeteer/browsers --help # help for all commands
npx @puppeteer/browsers install --help # help for the install command
npx @puppeteer/browsers launch --help # help for the launch command
```
2024-04-05 12:03:40 +00:00
Some example to give an idea of what the CLI looks like (use the `--help` command for more examples):
```sh
# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
npx @puppeteer/browsers install chrome@stable
# Download a specific Chrome for Testing version.
npx @puppeteer/browsers install chrome@116.0.5793.0
# Download the latest Chrome for Testing version for the given milestone.
npx @puppeteer/browsers install chrome@117
# Download the latest available ChromeDriver version corresponding to the Canary channel.
npx @puppeteer/browsers install chromedriver@canary
# Download a specific ChromeDriver version.
npx @puppeteer/browsers install chromedriver@116.0.5793.0
```
2023-04-11 12:47:25 +00:00
## Known limitations
2024-04-05 12:03:40 +00:00
1. Launching the system browsers is only possible for Chrome/Chromium.
2023-04-11 12:47:25 +00:00
## API
The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install` , `canInstall` , `launch` , `computeExecutablePath` , `computeSystemExecutablePath` and other methods.
2023-04-06 12:23:10 +00:00
## Classes
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Class
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "cli" > [CLI](./browsers.cli.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "installedbrowser" > [InstalledBrowser](./browsers.installedbrowser.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
2024-04-29 12:50:39 +00:00
**Remarks:**
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `InstalledBrowser` class.
2024-03-20 15:03:14 +00:00
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "process" > [Process](./browsers.process.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "timeouterror" > [TimeoutError](./browsers.timeouterror.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
2024-04-29 12:50:39 +00:00
**Remarks:**
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `TimeoutError` class.
2024-03-20 15:03:14 +00:00
< / td > < / tr >
< / tbody > < / table >
2023-04-06 12:23:10 +00:00
## Enumerations
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Enumeration
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "browser" > [Browser](./browsers.browser.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
Supported browsers.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "browserplatform" > [BrowserPlatform](./browsers.browserplatform.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
Platform names used to identify a OS platform x architecture combination in the way that is relevant for the browser download.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "chromereleasechannel" > [ChromeReleaseChannel](./browsers.chromereleasechannel.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< / tbody > < / table >
2023-04-06 12:23:10 +00:00
## Functions
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Function
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "candownload" > [canDownload(options)](./browsers.candownload.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "computeexecutablepath" > [computeExecutablePath(options)](./browsers.computeexecutablepath.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "computesystemexecutablepath" > [computeSystemExecutablePath(options)](./browsers.computesystemexecutablepath.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "createprofile" > [createProfile(browser, opts)](./browsers.createprofile.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "detectbrowserplatform" > [detectBrowserPlatform()](./browsers.detectbrowserplatform.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "getinstalledbrowsers" > [getInstalledBrowsers(options)](./browsers.getinstalledbrowsers.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
Returns metadata about browsers installed in the cache directory.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "getversioncomparator" > [getVersionComparator(browser)](./browsers.getversioncomparator.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
Returns a version comparator for the given browser that can be used to sort browser versions.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "install" > [install(options)](./browsers.install.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "install" > [install(options)](./browsers.install_1.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "launch" > [launch(opts)](./browsers.launch.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "makeprogresscallback" > [makeProgressCallback(browser, buildId)](./browsers.makeprogresscallback.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "resolvebuildid" > [resolveBuildId(browser, platform, tag)](./browsers.resolvebuildid.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "uninstall" > [uninstall(options)](./browsers.uninstall.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< / tbody > < / table >
2023-04-06 12:23:10 +00:00
## Interfaces
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Interface
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "getinstalledbrowsersoptions" > [GetInstalledBrowsersOptions](./browsers.getinstalledbrowsersoptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "installoptions" > [InstallOptions](./browsers.installoptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "launchoptions" > [LaunchOptions](./browsers.launchoptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "options" > [Options](./browsers.options.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "profileoptions" > [ProfileOptions](./browsers.profileoptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "systemoptions" > [SystemOptions](./browsers.systemoptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "uninstalloptions" > [UninstallOptions](./browsers.uninstalloptions.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< / tbody > < / table >
2023-04-06 12:23:10 +00:00
## Variables
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Variable
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "cdp_websocket_endpoint_regex" > [CDP_WEBSOCKET_ENDPOINT_REGEX](./browsers.cdp_websocket_endpoint_regex.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "webdriver_bidi_websocket_endpoint_regex" > [WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX](./browsers.webdriver_bidi_websocket_endpoint_regex.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < / tr >
< / tbody > < / table >