---
title: "Use the script editor | Grafana Cloud documentation"
description: "With the Script editor, you can quickly write test scripts from within the web app."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Use the script editor

The script editor is an integrated code editor available within Grafana Cloud k6, providing users with the convenience of writing scripts without the need to install applications on their local machines.

While many users [run cloud tests from the CLI](../../get-started/run-cloud-tests-from-the-cli/) with their preferred IDE, varying organizational security rules may restrict some users from installing applications without a security team review.

The script editor supports almost all features of k6, no local machine required.

## Create script

To create a new script using the script editor, follow these steps:

1. Open the k6 app in your Grafana instance.
2. Select **Projects**.
3. Create a new project, or choose an existing one.
4. Select **Create new test**.
5. Under **Script Editor**, select **Start Scripting**.

The script editor comes with a pre-configured example script that you can either edit manually or use the following options:

- **Script examples**: Choose from various included scripts to learn how to handle authentication, submit forms, or use different protocols.
- **Import HAR**: Import a HAR file, overwriting your existing script in the script editor.
- **Record a scenario**: Use the [browser recorder](../browser-recorder/) to create your script.

### Select a k6 runtime version

Open the **k6 runtime version** menu next to the script name and choose **v2.x**, or leave **v1.x (default)** for the v1.x runtime. Grafana Cloud k6 stores the version on the load test and uses it for future runs, including scheduled runs. If your script includes a `'use k6'` version directive, the selector is disabled and the script directive takes precedence.

For details, refer to [Use k6 versions in Grafana Cloud](/docs/grafana-cloud/testing/k6/author-run/k6-versions/).

After you’re done creating your script, select **Create** to save your script, or **Create and run** to save and run your test.

## Script editor features

The script editor has some built-in features to make it easier to write scripts.

- **Validation/error checking**
  
  If your script has a syntax error, the editor alerts you and prevents the script from running. Validation errors are displayed in the UI as:
  
  > `There are validation errors, please fix them in order to run the test`
- **Code Folding**
  
  Simplify reading and navigating your code by folding blocks of code using the down arrow next to the line numbers.
- **Variable highlighting**
  
  When you select a variable, the editor highlights other references to that variable in the script.
- **TypeScript support**
  
  Native TypeScript support allows you to write strongly typed code directly in the script editor without any additional setup.
- **Secret detection**
  
  The editor can flag potential secrets written in your script, such as API keys, tokens, and passwords. Move a finding into Secrets Management, or ignore it. For details, refer to [Move secrets from the script editor](/docs/grafana-cloud/testing/k6/author-run/manage-secrets/#move-secrets-from-the-script-editor).

## Limitations

The script editor can access all built-in k6 modules and [remote modules](/docs/k6/latest/using-k6/modules/#remote-https-modules).

However, if you need to import a custom library or file for parameterization, you must trigger your test [using the CLI](../../get-started/run-cloud-tests-from-the-cli/) instead.
