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

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

RTILA X PROJECT JSON

    {
  "name": "Parameterized_Product_URL",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/variables/2"
    ],
    "variables": [
      {
        "name": "product_id",
        "is_list": false,
        "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": "wait_for_selector",
      "params": {
        "selector": "css=.product-detail-page"
      }
    },
    {
      "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?