Skip to main content

variables Scenario 2 — Parameterized Product URL from Dataset

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Perform basic arithmetic with variables

Real-World Use Case

Calculating tax or discounts

LIVE DEMO

Parameterized Product URL

A product detail page reached via a substituted product_id.

Product 101 — Wireless Headphones

Driver Size40mm
Impedance32 Ohms
Battery Life30 hours
ConnectivityBluetooth 5.3
Weight250g
$299.99

The Wireless Headphones offer premium active noise cancellation, a lightweight build, and immersive sound quality for all-day listening.

EXPECTED OUTPUT

Product Specs

field value
Driver Size 40mm
Impedance 32 Ohms
Battery Life 30 hours
Connectivity Bluetooth 5.3
Weight 250g
RTILA X PROJECT JSON

RTILA X Automation Project

parameterized-product-url.json
{
  "name": "Parameterized_Product_URL",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/variables/2"
    ],
    "variables": [
      {
        "name": "product_id",
        "required": true,
        "value": "101"
      }
    ]
  },
  "datasets": {
    "product_specs": {
      "item_selector": "css=table.detail-specs tr",
      "properties": [
        {
          "name": "field",
          "type": "text",
          "selector": "css=th"
        },
        {
          "name": "value",
          "type": "text",
          "selector": "css=td"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/variables/product/${product_id}"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "product_specs"
      }
    }
  ]
}

A single global variable can be substituted into a URL using the ${variable} syntax. Here, the product ID is injected into the detail-page URL.

Did you complete this scenario?

Ready to run this automation?

Copy the project JSON above, open RTILA X, create a new project, and paste it.

This scenario covers 1 RTILA X command and is referenced in 1 learning article.

Continue Learning

Was this helpful?