> For the complete documentation index, see [llms.txt](https://docs.qyrus.com/web-testing/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qyrus.com/web-testing/build/creatingsteps.md).

# Test Steps

A test step is one action performed on a web page — open a URL, click a button, type a value, check that some text appeared. A test script is simply an ordered list of these steps.

Every step has three parts:

* **Action** — what the step does, for example **Go to url**, **Click**, **Verify Text Present**
* **Description** — a plain-English line saying what the step is for. This is **required**.
* **Element and value** — which element on the page the step acts on, and any data it needs

What the third part asks for depends on the action. **Go to url** wants a URL; **Click** wants an element; **Wait** wants a duration.

## Prerequisites

* A project, a module and a test script. See [Test Scripts](/web-testing/build/creatingscript.md).

## The script editor

Opening a script takes you to the step editor.

![Script editor](https://239974709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FycS61vFhJMvvtnJCrDJk%2Fuploads%2Fgit-blob-2fe832ed83f6d60ee91423d312c666aa93f19196%2Fbuild-steps-01.png?alt=media)

Across the top: **Select All**, **Search Steps**, **Export as**, **Save** and **Dry Run**. A red **Data Use Notice** reminds you not to enter production or sensitive data.

## Adding a step

1. Click **Add Step** at the bottom of the list.
2. Click the action button on the new row to open the **Action Types** panel, and choose an action. A first step is usually **Launch** → **Go to url**.
3. Type a description in **Enter step description**.
4. Fill in whatever the action needs. For **Go to url** that is the **Url** field.

   ![A step expanded](https://239974709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FycS61vFhJMvvtnJCrDJk%2Fuploads%2Fgit-blob-43596f0defd7be33d3c7f21c2965e4580b13e41c%2Fbuild-steps-02.png?alt=media)
5. Click **Save**.

**The description is mandatory.** Saving with an empty description fails with "Description Required". This is the most common reason a save does not go through.

For the full list of available actions, see [Action Types](/web-testing/user-actions/actiontype.md).

## Telling a step which element to act on

Most actions need to know *which* thing on the page to act on — which button to click, which box to type into. A **Go to url** step does not, which is why the first step is the easy one. A **Click** step does.

The page has no way of knowing you mean "the Sign in button", so you point at the element using a **locator**: a rule that picks out one element on the page.

A locator has two parts, and the step asks for both:

* **Locator** — the *kind* of rule you are using
* **Locator Id \*** — the value that rule looks for

For example, choose **Id** as the locator and type `signin-button` as the value, and the step acts on the element whose id is `signin-button`.

### The kinds of locator

| Locator               | Finds an element by                                       |
| --------------------- | --------------------------------------------------------- |
| **Id**                | Its id — usually the most reliable, when the page has one |
| **Name**              | Its name                                                  |
| **Class**             | Its styling class                                         |
| **linktext**          | The full text of a link                                   |
| **partiallink**       | Part of the text of a link                                |
| **Xpath**             | Its position in the page's structure                      |
| **Css**               | A CSS rule                                                |
| **Span**              | Text inside a span                                        |
| **Custom**            | A rule you define yourself                                |
| **Recorded Elements** | An element captured earlier with the recorder             |

**Prefer Id where the page offers one.** Ids tend to survive redesigns; a rule based on position breaks as soon as the page layout moves.

### Where the values come from

You do not have to work these out by hand. The **Qyrus Recorder** browser extension watches you use your application and captures the elements you interact with, so you can pick them from **Recorded Elements** instead of typing a rule. Set it up from **Project Setup** → see [Project Setup](/web-testing/build/projectsetup.md).

If a locator does stop working because the application changed, [Healer AI](/web-testing/advanced-features/healer.md) can suggest a corrected one from a run that previously passed.

## The buttons on a step row

| Button             | What it does                                                                                                                     |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| **Parameterize**   | Feeds the step values from a data file instead of a fixed value. See [Parameterization](/web-testing/build/parameterization.md). |
| **Screenshot**     | Captures a screenshot of this step during a run. On by default.                                                                  |
| **Optional Step**  | Lets the run continue even if this step fails.                                                                                   |
| **Insert Step**    | Adds a new step directly below this one.                                                                                         |
| **Expand**         | Shows or hides the step's settings.                                                                                              |
| **Shadow Element** | Tells Qyrus the element sits inside a shadow DOM. Appears only on steps that act on an element.                                  |
| **⋮**              | **Move Step to**, **Clone Step**, **Delete Step**                                                                                |

Above the list, **Select All** with the move and bin buttons lets you act on several steps at once — **Move Step To** and **Delete steps** — and **Expand / Collapse steps** opens or closes all steps together.

## The right-hand panel

The panel on the right has its own tabs. Which ones you see depends on what you are doing:

* **Info** — the test number, the script name and objective, an **Actions** section with **Start recording steps**, **Create function** and **Import File (XLSX,JSON)**, the script's **Tags**, the suites the script is linked to, and who created and last updated it.
* **Help** — guidance for the action you are editing.
* **Versions** — restore points you have taken, so you can roll the script back.
* **Global Variable** — the variables available to this script, by environment.
* **Parameter File** — appears once a step is parameterized. See [Parameterization](/web-testing/build/parameterization.md).

## Using a global variable in a step

Values defined in **Project Setup → Global Variable** can be used in any step. Type the variable name wrapped in `#` characters, for example `#Login_Url#`.

To find the available variables while editing, open the right-hand panel, choose the **Global Variable** tab, pick the environment, and copy the variable you need.

See [Project Setup](/web-testing/build/projectsetup.md) for how to create them.

## Where to go next

Once your steps are in, run the script to see whether it works.

| To read about                                            | Go to                                                           |
| -------------------------------------------------------- | --------------------------------------------------------------- |
| Checking the test works, while you are still building it | [Dry Run](/web-testing/run/dryrun.md)                           |
| Everything a step can do                                 | [Action Types](/web-testing/user-actions/actiontype.md)         |
| Running one script against many sets of data             | [Parameterization](/web-testing/build/parameterization.md)      |
| Renaming, cloning, moving and deleting scripts           | [Managing Test Scripts](/web-testing/build/scriptoperations.md) |
