Skip to main content

dynamic-content Scenario 5 — Wait for WebSocket Update

Written by RTILA X Engineering Team

Advanced ~10 min
Prerequisites: dynamic-content/3 dynamic-content/4

What You'll Learn

Combine multiple dynamic loading strategies

Real-World Use Case

Extracting data from complex single-page apps

LIVE DEMO

Waiting for WebSocket update...

EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "Wait_For_WebSocket_Update",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/dynamic-content/5"
    ]
  },
  "datasets": {
    "ws_data": {
      "item_selector": "css=table.ws-data-table tr",
      "properties": [
        {
          "name": "row",
          "type": "text",
          "selector": "css=self"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.ws-content",
        "timeout": 15000
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "ws_data"
      }
    }
  ]
}
  

WebSocket updates are asynchronous and may arrive after the page load. Using wait_for_selector on the new content element ensures extraction occurs only after the update is visible.

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?