Skip to main content

pagination Scenario 2 — Paginated Search Results

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Scroll to load more content dynamically

Real-World Use Case

Extracting data from infinite-scroll feeds

LIVE DEMO

Paginated Search Results

A simulated 10-page result set collected page by page.

Result 1

The first paginated search result available on this demonstration page.

/scenarios/pagination/result/1

Result 2

The second paginated search result available on this demonstration page.

/scenarios/pagination/result/2

Result 3

The third paginated search result available on this demonstration page.

/scenarios/pagination/result/3

Result 4

The fourth paginated search result available on this demonstration page.

/scenarios/pagination/result/4

Result 5

The fifth paginated search result available on this demonstration page.

/scenarios/pagination/result/5

Result 6

The sixth paginated search result available on this demonstration page.

/scenarios/pagination/result/6

Result 7

The seventh paginated search result available on this demonstration page.

/scenarios/pagination/result/7

Result 8

The eighth paginated search result available on this demonstration page.

/scenarios/pagination/result/8

Result 9

The ninth paginated search result available on this demonstration page.

/scenarios/pagination/result/9

Result 10

The tenth paginated search result available on this demonstration page.

/scenarios/pagination/result/10
EXPECTED OUTPUT

Search Results

title
Result 1
Result 2
Result 3
Result 4
Result 5
Result 6
Result 7
Result 8
Result 9
Result 10
Result 11
Result 12
Result 13
Result 14
Result 15
Result 16
Result 17
Result 18
Result 19
Result 20
Result 21
Result 22
Result 23
Result 24
Result 25
Result 26
Result 27
Result 28
Result 29
Result 30
RTILA X PROJECT JSON

RTILA X Automation Project

extract-paginated-search.json
{
  "name": "Extract_Paginated_Search",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/pagination/2"
    ]
  },
  "datasets": {
    "search_results": {
      "item_selector": "css=.page-item",
      "properties": [
        {
          "name": "title",
          "type": "text",
          "selector": "css=.item-title"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.page-item"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "search_results"
      }
    },
    {
      "command": "while",
      "params": {
        "condition": {
          "type": "element_visible",
          "selector": "css=a.next-page:not(.disabled)"
        },
        "do": [
          {
            "command": "click",
            "params": {
              "selector": "css=a.next-page"
            }
          },
          {
            "command": "wait_for_load_state",
            "params": {
              "state": "networkidle"
            }
          },
          {
            "command": "extract_data",
            "params": {
              "dataset": "search_results"
            }
          }
        ]
      }
    }
  ]
}

This scenario introduces a simulated 10-page search result set. The while loop continues until the Next link is disabled, allowing the automation to collect results from every page without knowing the exact page count in advance.

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 1 learning article.

Continue Learning

Was this helpful?