# The browser for screenshots

> Says whether `osy test --pixels` has a real browser to draw with on this computer, and installs what is missing once, for every project — after saying what it will download and being told yes.

<!-- id: local-the-browser-for-screenshots · area: local · stability: preview · html: https://osysharp.com/reference/local/the-browser-for-screenshots/ -->

## Summary        {#summary}

`osy test --pixels` draws your pages in a real browser, checks their layout and photographs them
([Layout assertions — is it actually usable on screen?](https://osysharp.com/reference/testing/ui-layout/)). That needs a program that drives a browser — Playwright — and a browser. `osy browser` tells
you whether both are there, and `osy browser install` adds what is missing in one place that every project on this
computer uses.

## Signature      {#signature}

```console
osy browser [status|install] [--yes] [--json]
```

## Description    {#description}

- **`osy browser`** (or `osy browser status`) answers in a sentence: ready, or what is missing. When something can be
  installed it lists each download — what it is, about how big, where it comes from and where it goes — before
  anything is fetched.
- **`osy browser install`** shows that same list and asks — **Enter is yes**. On yes it installs Playwright into `~/.osy/browser`. If
  Google Chrome is on the computer that is all: Playwright drives it. Only when no browser can be started does it
  ask a second time, for a browser of its own. **Nothing is downloaded without a yes**; run by a program, with
  nobody to ask, it downloads nothing unless `--yes` is given.
- It is installed **once per user, not per project**. A project with nothing installed in it — a new one, one an
  agent is building — takes screenshots straight away, and no running local platform has to be restarted. A project
  that has its own `playwright` in `node_modules` keeps using its own.
- `--json` answers for a program: `ready`, `needs` (`nothing`, `package`, `browser`, `node`, `switched-off`,
  `unknown`), `canInstall`, `downloads`, `home`, `message`.

### Where else it is offered   {#offered}

You rarely need to type it. **`osy init`** asks once, at the end, when a person is at the terminal;
**`osy shot`** asks when it needs a browser to take its picture; Studio's first-time setup has a "Yes, install it"
for it; and **`osy test` and `osy check`**, when your UI tests pass on a computer without a browser, say that nobody
has seen those pages yet and name `osy browser install`. Each asks the same way, and none asks when it is run by a
program — a script or an agent's tool call gets the command to run instead.

### What it does not install   {#node}

**Node.js.** Every test that draws a page already needs `node` (22 or newer), and `osy browser` uses its `npm` to
fetch Playwright. When there is none, `status` says so and names where to get it; nothing else can be done until it
is there.
On Windows that `npm` is started the way `npm.cmd` starts it — Node, with npm's own script from Node's folder — so
it works whatever folder it is installing into.

## Examples       {#examples}

```console
osy browser                 # ready, or what is missing and what a yes would download
osy browser install         # asks, then installs it for every project on this computer
osy browser install --yes   # for a program that has already asked its person
```

## See also       {#see-also}

[Layout assertions — is it actually usable on screen?](https://osysharp.com/reference/testing/ui-layout/) — what `--pixels` can assert that the default tier cannot.

[Opening Studio](https://osysharp.com/reference/local/opening-studio/) — Studio's "Check my setup" asks this same question, and runs this same install on a yes.
