Skip to main content

complex-workflows Scenario 5 — Login → Order History → Expand → Paginate → Export

Written by RTILA X Engineering Team

Intermediate ~6 min
Prerequisites: complex-workflows/1 complex-workflows/2 complex-workflows/3

What You'll Learn

Paginate through order history while extracting data

Real-World Use Case

Generating monthly purchase reports

LIVE DEMO

Login → Order History → Paginate

Sign in, expand an order, paginate the list, and extract order data.

EXPECTED OUTPUT

Orders

order_id date items
ORD-101 2025-01-05 2
ORD-102 2025-01-08 1
ORD-103 2025-01-12 3
ORD-104 2025-01-15 1
ORD-105 2025-01-20 3
RTILA X PROJECT JSON

RTILA X Automation Project

login-order-history-expand-paginate.json
{
  "name": "Login_Order_History_Expand_Paginate",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/complex-workflows/5"
    ]
  },
  "datasets": {
    "orders": {
      "item_selector": "css=.cw-order",
      "properties": [
        {
          "name": "order_id",
          "type": "text",
          "selector": "css=.cw-order-id"
        },
        {
          "name": "date",
          "type": "text",
          "selector": "css=.cw-order-date"
        },
        {
          "name": "items",
          "type": "count",
          "selector": "css=.cw-order-items .cw-order-item-row"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "fill",
      "params": {
        "selector": "css=#login-email",
        "value": "user@example.com"
      }
    },
    {
      "command": "fill",
      "params": {
        "selector": "css=#login-password",
        "value": "pass123"
      }
    },
    {
      "command": "click",
      "params": {
        "selector": "css=#login-btn"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=.cw-orders"
      }
    },
    {
      "command": "repeat",
      "params": {
        "times": 2,
        "do": [
          {
            "command": "try_catch",
            "params": {
              "try": [
                {
                  "command": "click",
                  "params": {
                    "selector": "css=.cw-order-expand >> nth=${loop_index - 1}"
                  }
                },
                {
                  "command": "wait",
                  "params": {
                    "timeout": 400
                  }
                },
                {
                  "command": "extract_data",
                  "params": {
                    "dataset": "orders",
                    "filter_condition": "item.items > 0"
                  }
                }
              ],
              "catch": [
                {
                  "command": "comment",
                  "params": {
                    "text": "No order at this index on current page"
                  }
                }
              ]
            }
          }
        ]
      }
    },
    {
      "command": "while",
      "params": {
        "condition": {
          "type": "element_visible",
          "selector": "css=a.cw-next:not(.disabled)"
        },
        "do": [
          {
            "command": "click",
            "params": {
              "selector": "css=a.cw-next"
            }
          },
          {
            "command": "wait",
            "params": {
              "timeout": 500
            }
          },
          {
            "command": "repeat",
            "params": {
              "times": 2,
              "do": [
                {
                  "command": "try_catch",
                  "params": {
                    "try": [
                      {
                        "command": "click",
                        "params": {
                          "selector": "css=.cw-order-expand >> nth=${loop_index - 1}"
                        }
                      },
                      {
                        "command": "wait",
                        "params": {
                          "timeout": 400
                        }
                      },
                      {
                        "command": "extract_data",
                        "params": {
                          "dataset": "orders",
                          "filter_condition": "item.items > 0"
                        }
                      }
                    ],
                    "catch": [
                      {
                        "command": "comment",
                        "params": {
                          "text": "No order at this index on current page"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

This workflow combines authentication, list expansion, pagination, and extraction. It demonstrates how multiple actions can be chained to collect order data.

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 3 RTILA X commands and is referenced in 2 learning articles.

Continue Learning

Was this helpful?