> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/test-steps/browser/run-browser-script.md).

# Run Browser Script

Run browser script executes custom JavaScript in the page. Use it when you need logic the built-in steps do not cover, such as a calculation, a DOM read, or a small helper.

Read Values with `VALUES.yourKey` inside the script. The `$` picker works in other Test Step fields. The script field is JavaScript, so use the `VALUES` object instead.

![Run browser script Test Step](https://app.does.qa/screenshots/node/browser_script.png)

## When to use it

* **Store** mode saves the script return value under **Response Storage Name** for later steps.
* **Check** mode asserts the script result as part of the step outcome.
* Prefer built-in Action and Check steps when they already cover the job.

## Configure

### Basics

| Field                     | What to set                                                        |
| ------------------------- | ------------------------------------------------------------------ |
| **Label**                 | Optional label shown in results                                    |
| **JavaScript**            | The script to run. Use `VALUES.key` for stored Values              |
| **Mode**                  | `Store` (default) or `Check`                                       |
| **Response Storage Name** | Where to save the return value in Store mode (`output` by default) |

### Advanced

| Field                                 | What to set                                          |
| ------------------------------------- | ---------------------------------------------------- |
| **When should screenshots be taken?** | `Always` or `On Failures` (default)                  |
| **Status on fail**                    | [Failed Status](/test-step-options/failed-status.md) |

{% hint style="info" %}
**Pro tip:** If a Value looks empty in the script, confirm an earlier step wrote that storage name and that you used `VALUES.yourKey`, not `$yourKey`.
{% endhint %}

## Related

* [Value Store](/values/value-store.md)
* [Share data with Values](/better-coverage/share-data-with-values.md)
* [Browser](/test-steps/browser.md)

**Tags:** `browser`, `script`, `javascript`, `VALUES`
