Skip to main content

complex-workflows Scenario 2 — Cross-Site Price Comparison

Written by RTILA X Engineering Team

Beginner ~4 min

What You'll Learn

Use variables to pass data between steps

Real-World Use Case

Carrying a user ID across pages

LIVE DEMO

IDNamePrice
1Wireless Mouse$24.99
2USB-C Hub$39.99
3Mechanical Keyboard$89.99
44K Monitor$329.99
5Webcam$59.99
IDNamePrice
1Wireless Mouse$22.49
2USB-C Hub$34.99
3Mechanical Keyboard$94.99
44K Monitor$315.99
5Webcam$54.99
ProductSite ASite BDifference
Wireless Mouse $24.99 $22.49 $2.50
USB-C Hub $39.99 $34.99 $5.00
Mechanical Keyboard $89.99 $94.99 $-5.00
4K Monitor $329.99 $315.99 $14.00
Webcam $59.99 $54.99 $5.00
EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "Cross_Site_Price_Comparison",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/complex-workflows/2"
    ]
  },
  "datasets": {
    "site_a_products": {
      "item_selector": "css=table.site-a-products tbody tr",
      "properties": [
        {
          "name": "id",
          "type": "text",
          "selector": "css=td:nth-child(1)"
        },
        {
          "name": "name",
          "type": "text",
          "selector": "css=td:nth-child(2)"
        },
        {
          "name": "price",
          "type": "text",
          "selector": "css=td:nth-child(3)"
        }
      ]
    },
    "site_b_products": {
      "item_selector": "css=table.site-b-products tbody tr",
      "properties": [
        {
          "name": "id",
          "type": "text",
          "selector": "css=td:nth-child(1)"
        },
        {
          "name": "name",
          "type": "text",
          "selector": "css=td:nth-child(2)"
        },
        {
          "name": "price",
          "type": "text",
          "selector": "css=td:nth-child(3)"
        }
      ]
    },
    "comparison": {
      "item_selector": "css=table.comparison-table tbody tr",
      "properties": [
        {
          "name": "product",
          "type": "text",
          "selector": "css=td:nth-child(1)"
        },
        {
          "name": "site_a",
          "type": "text",
          "selector": "css=td:nth-child(2)"
        },
        {
          "name": "site_b",
          "type": "text",
          "selector": "css=td:nth-child(3)"
        },
        {
          "name": "difference",
          "type": "text",
          "selector": "css=td:nth-child(4)"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=table.site-a-products"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "site_a_products"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=table.site-b-products"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "site_b_products"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=table.comparison-table"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "comparison"
      }
    },
    {
      "command": "comment",
      "params": {
        "text": "Trigger chain could generate a price difference report and send it via email"
      }
    }
  ]
}
  

Cross-site comparison extracts matching product sets from two tables and writes a third summary table. A trigger chain can then email the results.

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?