## TL;DR

This error means a spec is tagged `js: true` but no javascript driver is registered with Capybara. The default rack-test driver cannot run JavaScript. Install a browser-backed driver gem such as selenium-webdriver, add it to the test group in your Gemfile, require it in your spec helper, and set `Capybara.javascript_driver` to the registered name. Then your js specs have a real browser to run in.

## The query

```text
rspec capybara js driver not installed: how to fix
```

## Use this when

- `js: true` specs raise "js driver not installed" or similar.
- You are setting up Capybara browser testing for the first time.

## Not for

- Picking selenium vs cuprite vs apparition; this is just getting one working.
- Flaky js specs that already run.

## Steps

1. Open your spec helper and find the `Capybara.javascript_driver` setting and the driver name it references. Expected output: you know the expected driver name.
2. Add the matching gem (e.g. `selenium-webdriver`) to the `:test` group in your Gemfile and run `bundle install`. Expected output: the gem installs with no errors.
3. Require the gem and register the driver in your spec helper, e.g. `Capybara.register_driver :selenium_chrome_headless`. Expected output: the driver registers without raising.
4. Run one `js: true` spec. Expected output: the spec runs in a real browser instead of raising the driver error.
5. Run the whole js-tagged subset to confirm the setup holds. Expected output: js specs pass or fail on their own merits.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_aLh3RDthKIAkPe7CImg7OQ
