Skip to main content

loops Scenario 2 — Extract Each Product Card

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Extract data from repeated elements

Real-World Use Case

Collecting product cards from a grid

LIVE DEMO

Electronics Auralis

Wireless Noise-Cancelling Headphones

Premium over-ear headphones with active noise cancellation and 30-hour battery life.

USD249.99 ★★★★★ (128 reviews)
audiowirelessnoise-cancelling
Electronics LumenTech

4K Ultra HD Monitor

32-inch 4K UHD display with 95% DCI-P3 coverage and USB-C hub.

USD499.99 ★★★★★ (95 reviews)
display4kusb-c
Electronics KeyForge

Mechanical Gaming Keyboard

Hot-swappable mechanical keyboard with per-key RGB and aluminum frame.

USD129.99 ★★★★★ (210 reviews)
keyboardgamingrgb
Electronics ConnectHub

USB-C Docking Station

12-in-1 hub with dual HDMI, SD card slots, Ethernet, and 100W power delivery.

USD159.99 ★★★★☆ (74 reviews)
usb-cdockinghub
Electronics SwiftStore

Portable SSD 1TB

Pocket-sized solid state drive with 1050 MB/s read speeds and shock resistance.

USD99.99 ★★★★★ (188 reviews)
ssdstorageportable
Electronics NestCore

Smart Home Hub

Centralized smart home controller compatible with Zigbee, Z-Wave, and Wi-Fi devices.

USD79.99 ★★★★☆ (143 reviews)
smart-homehubautomation
Electronics VoltEdge

Wireless Charging Pad

15W fast wireless charging pad with slim aluminum design and LED indicator.

USD29.99 ★★★★☆ (310 reviews)
chargingwirelessqi
Electronics EchoWave

Bluetooth Speaker

Waterproof portable speaker with 360° sound and 20-hour battery.

USD59.99 ★★★★☆ (265 reviews)
speakerbluetoothportable
Clothing EverThread

Classic Cotton T-Shirt

100% combed cotton crew neck tee with regular fit and pre-shrunk fabric.

USD19.99 ★★★★☆ (421 reviews)
tshirtcottoncasual
Clothing NorthDune

Slim Fit Jeans

Stretch denim jeans with modern slim silhouette and dark indigo wash.

USD69.99 ★★★★☆ (312 reviews)
jeansdenimslim-fit
Clothing StormPeak

Waterproof Rain Jacket

Seam-sealed waterproof shell with adjustable hood and breathable fabric.

USD119.99 ★★★★★ (89 reviews)
rainwearjacketwaterproof
SOLD OUT Clothing StridePro

Running Sneakers

Lightweight running shoes with responsive foam midsole and breathable mesh upper.

USD129.99 ★★★★★ (198 reviews)
runningshoesathletic
EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "Extract_Product_Cards",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/loops/2"
    ]
  },
  "datasets": {
    "products": {
      "item_selector": "css=.product-item",
      "properties": [
        {
          "name": "name",
          "type": "attribute",
          "selector": "css=[data-product-name]",
          "attribute": "data-product-name"
        },
        {
          "name": "price",
          "type": "attribute",
          "selector": "css=[data-product-price]",
          "attribute": "data-product-price"
        },
        {
          "name": "category",
          "type": "attribute",
          "selector": "css=[data-product-category]",
          "attribute": "data-product-category"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.product-item"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "products"
      }
    }
  ]
}
  

RTILA X Concepts

Extracting repeated elements is handled by defining a dataset with an item_selector that matches each product card, plus properties for the nested title, price, and category selectors.

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 2 RTILA X commands and is referenced in 2 learning articles.

Continue Learning

Was this helpful?