Skip to main content

api-interception Scenario 5 — Scroll to Trigger API Calls and Repeat

Written by RTILA X Engineering Team

Advanced ~10 min
Prerequisites: api-interception/3 api-interception/4

What You'll Learn

Detect tech stack and intercept console messages

Real-World Use Case

Auditing third-party scripts on a page

LIVE DEMO

Infinite Scroll API

Scroll the container to trigger paginated API calls and load all 15 items.

EXPECTED OUTPUT

Scroll Items

title description
Item 1 Description for item 1
Item 2 Description for item 2
Item 3 Description for item 3
Item 4 Description for item 4
Item 5 Description for item 5
Item 6 Description for item 6
Item 7 Description for item 7
Item 8 Description for item 8
Item 9 Description for item 9
Item 10 Description for item 10
Item 11 Description for item 11
Item 12 Description for item 12
Item 13 Description for item 13
Item 14 Description for item 14
Item 15 Description for item 15
RTILA X PROJECT JSON

RTILA X Automation Project

scroll-triggered-api-calls.json
    {
  "name": "Scroll_Triggered_API_Calls",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/api-interception/5"
    ]
  },
  "datasets": {
    "scroll_items": {
      "item_selector": "css=.scroll-api-item",
      "properties": [
        {
          "name": "title",
          "type": "text",
          "selector": "css=.scroll-item-title"
        },
        {
          "name": "description",
          "type": "text",
          "selector": "css=.scroll-item-desc"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.scroll-api-item"
      }
    },
    {
      "command": "infinite_scroll",
      "params": {
        "selector": "css=.scroll-container",
        "max_scrolls": 5,
        "scroll_delay": 800,
        "do": [
          {
            "command": "extract_data",
            "params": {
              "dataset": "scroll_items"
            }
          }
        ]
      }
    }
  ]
}
  

Infinite scrolling triggers API calls at the bottom of a container. The infinite_scroll command repeatedly scrolls, waits for new items, and extracts them until all 15 items are collected.

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?