Skip to main content
Extractions let you capture data from your application during a test run and reuse it in later steps. Instead of hardcoding values, you store them as variables that Spur carries forward throughout the test.

When to use extract

Use an extract step when your test needs to remember a value from one page and use it on another. Common scenarios include:
  • Cross-page validation — You’re on a product listing page (PLP) and want to capture a product name and price, then verify those same values appear correctly on the product detail page (PDP) and again at checkout.
  • Capturing generated data — Your application creates something new (an order confirmation number, a ticket ID, a username) and you need that value in a later step or a dependent test.
  • Dynamic content — The data changes on every run (timestamps, generated emails, randomized content), so you can’t hardcode it in your test.

How extract reads the page

How Extract finds a value depends on whether your test runs in a browser or in a native mobile app.

Web

On web runs in Chrome, Edge, Firefox, and Safari, Extract reads the live page over a few rounds, not only the screenshot. It can capture:
  • Content anywhere on the page, including content below the fold, hidden or off-screen content, iframes, and shadow DOM
  • Element attributes, such as a link’s href, an input’s value, alt text, or data-* attributes
  • Computed styles, such as a color as hex, a font size, or an element’s size
  • A network response, when the description names the request or API
Extract scrolls at most 3 screens and waits up to 10 seconds for a value that is still loading. A description can also ask for a derived value, such as a count, a yes or no answer, a comparison, a sum, or the item that matches a description. Name the format when it matters, for example “as digits” or “as YYYY-MM-DD”. Spur copies text that the page shows exactly. Words like “first”, “last”, and “the 3rd” count in page order over the whole page, not only the visible part.
On web runs, Extract fails the step when it can’t find a value, and the test stops. Previously, Extract stored Not found and the step passed. To capture whether something is present, ask a yes or no question such as “whether a discount line is shown”, then verify the saved answer. Do not extract a missing value to prove it is absent.
When an Extract step fails this way, its error box includes a note explaining that Extract now searches the page like an agent. In the screenshot view, each value Extract couldn’t find is listed as Not on the page.

Native mobile

On native mobile runs, Extract reads only the screenshot, in a single pass. It captures what is currently visible on the page and stores Not found for a missing value instead of failing the step. Add the extract step at the point in your test where the value you need is on screen.
Extract only reads the page. If the value is behind a tab, a collapsed section, or a dialog, open the tab, expand the section, or dismiss the dialog in the step before the extract step.

How to add an extract step

1

Open the step menu

Type extract in the step input, or use / and choose Extract a value.
Step menu showing extract a value option
2

Configure the extraction

Enter a Variable Name and an Extraction Description that tells Spur exactly what to capture from the page. You can extract up to 5 variables in a single extract step.To use a scenario value in the description, type [ and choose a property from your scenario table. For example, Price of [Product_name]. When the test runs, Spur replaces the property with the value from each scenario row.
Extract configuration with variable name and extraction instruction
3

Save the step

Click Save Step. The step now shows the variable name it will extract.
Saved extract step
4

Use the variable in later steps

In any subsequent step, type { to open the variable menu and select your extracted variable.
Variable menu showing extracted value
After a test run, you can see the extracted values in the Environment tab of the Spur Console.
Environment tab showing extracted variable and its value

Example: Validate product data across pages

A common e-commerce test needs to verify that a product’s name and price stay consistent from the listing page, through the detail page, and into the cart. Here’s how to build that with extract steps:
1

Extract the product name on the PLP

On the product listing page, add an extract step to capture the product name into a variable called PRODUCT.
2

Click into the product

Use the extracted variable to click on the correct product: Click on {PRODUCT}.
3

Extract the price on the PDP

Now on the product detail page, add another extract step to capture the price into a variable called PRICE.
4

Add to cart and verify

Click Add to cart, then add a verify step to confirm the cart shows the correct product name and price using your extracted variables.
Here’s what this test looks like in Spur:
E-commerce test flow showing extract PRODUCT, click product, extract PRICE, add to cart, and verify
You can extend this pattern to the checkout page by adding more verify steps that reference the same PRODUCT and PRICE variables — no need to extract again.

Example: Capture a confirmation number for a dependent test

When your application generates data (like an order confirmation number), you can extract it and pass it to a future step or a dependent test:
  1. Complete the flow that generates the data (e.g., place an order).
  2. Add an extract step to capture the confirmation number into a variable like order_id.
  3. In a later step, reference {order_id} to look up or verify the order.
If you need this value in a separate test, use the extracted variable as a dependency so the downstream test receives it automatically.

Generating random emails

You can generate random email addresses directly in your test steps using natural language. This is useful for sign-up flows, form submissions, or any scenario that requires a unique email each time. In a Type step, describe the email format you want. For example:
Spur generates a new email like abcdefghij@testdomain.com on each run. To reuse this email later in your test, add an Extract step right after to save it as a variable.
If an earlier step creates a SpurMail inbox, you can add its address inline. Type @ in a later step and select Insert current email inbox address. You don’t need a separate Extract step.

Accessing extracted variables in JavaScript

You can access extracted variables in JavaScript steps using the window.env or env object:
For example, if you extracted a value into a variable called Email_address, you can reference it in a JavaScript step as window.env.Email_address or env.Email_address.

More examples

Extract an error message into a variable, then verify it matches the expected text. Useful when error wording is dynamic or locale-dependent.
Form validation flow extracting ERROR_MESSAGE and verifying it
Extract multiple values (like a count and a timestamp) in a single extract step, then use both in a verify step.
Data processing flow extracting COUNT and TIMESTAMP