Skip to main content

loops Scenario 3 — Wait for Loading Spinner and Extract

Written by RTILA X Engineering Team

Intermediate ~6 min
Prerequisites: loops/1 loops/2

What You'll Learn

Poll for a loading spinner to disappear

Real-World Use Case

Waiting for dynamic content to load

LIVE DEMO

Loading posts...
EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "Wait_For_Loading_Spinner",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/loops/3"
    ],
    "headless": false,
    "navigation_timeout": 30000,
    "max_concurrent_workers": 1,
    "humanoidEnabled": true,
    "humanoidSensitivity": "medium"
  },
  "datasets": {
    "posts": {
      "item_selector": "css=.post-item",
      "properties": [
        {
          "name": "content",
          "type": "text",
          "selector": "css=.post-content"
        },
        {
          "name": "author",
          "type": "text",
          "selector": "css=.post-author"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/loops/3"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.loading-spinner"
      }
    },
    {
      "command": "while",
      "params": {
        "condition": {
          "type": "element_visible",
          "selector": "css=.loading-spinner"
        },
        "do": [
          {
            "command": "wait",
            "params": {
              "timeout": 2000
            }
          }
        ]
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.post-item"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "posts"
      }
    }
  ]
}
  

RTILA X Concepts

A while loop can poll for a loading indicator. Once the spinner is no longer visible, the automation waits for the post items and extracts them.

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?