# install_chrome()

Download `chrome-headless-shell` from Chrome for Testing into nokap's cache.

Usage

[Source](https://github.com/posit-dev/nokap/blob/main/nokap/_install.py#L159-L229)

``` python
install_chrome(
    version="stable",
    *,
    force=False,
)
```

`chrome-headless-shell` is Chrome's standalone headless build. It starts in environments where full Chrome can't, such as the macOS sandboxes used by coding agents, and it starts faster. Once installed, [find_chrome()](../reference/find_chrome.md#nokap.find_chrome) prefers it over a system Chrome (`CHROME_PATH` still takes precedence). Nothing is downloaded unless you call this function (or run `nokap install-chrome`).

## Parameters

`version: str = "stable"`  
A release channel (`"stable"`, `"beta"`, `"dev"`, `"canary"`), a milestone such as `"156"`, or an exact version such as `"156.0.8078.80"`.

`force: bool = False`  
Reinstall even if this version is already present.

## Returns

`str`  
Path to the `chrome-headless-shell` executable.

## Raises

`NokapError`  
If the version can't be resolved, no build exists for this platform, or the download fails.

## Examples

``` python
import nokap

path = nokap.install_chrome()
nokap.find_chrome() == path  # True unless CHROME_PATH is set
```
