Skip to main content

basic-navigation Scenario 8 — Count Review Cards

Written by RTILA X Engineering Team

Intermediate ~6 min

What You'll Learn

Count repeated elements on a page

Real-World Use Case

Validating the number of reviews displayed

LIVE DEMO

Review List

Twelve review cards, each with a name and star rating.

Alex M.

★★★★★

Outstanding sound quality

Jordan P.

★★★★☆

Comfortable for long flights

Casey W.

★★★★☆

Great wireless experience

Drew K.

★★★★★

Perfect upgrade

Sam B.

★★★★★

Crisp 4K

Leslie G.

★★★★☆

Great value

Morgan T.

★★★★★

Beautiful display

Riley N.

★★★★☆

Highly recommended

Quinn F.

★★★★★

Keyboard heaven

Hollis D.

★★★★☆

Solid build

Avery S.

★★★★★

Typing feels great

Emery L.

★★★☆☆

Good but not perfect

EXPECTED OUTPUT

Review Card Count

12

RTILA X PROJECT JSON

RTILA X Automation Project

count-review-cards.json
    {
  "name": "Count_Review_Cards",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/basic-navigation/8"
    ]
  },
  "datasets": {
    "review_count": {
      "item_selector": "css=html",
      "properties": [
        {
          "name": "count",
          "type": "count",
          "selector": "css=.review-card"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/basic-navigation/8"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.review-card"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "review_count"
      }
    }
  ]
}
  

RTILA X Concepts

The count property type returns the number of matching elements rather than their content. The parent selector here is css=html so the entire page is considered one context.

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 2 learning articles.

Continue Learning

Was this helpful?