Skip to main content

forms Scenario 6 — CSV Data Form Filling Loop

Written by RTILA X Engineering Team

Advanced ~10 min

What You'll Learn

Assert form values and validate outputs

Real-World Use Case

Building automated QA tests for web forms

LIVE DEMO

EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "CSV_Data_Form_Filling",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/forms/6"
    ],
    "headless": false,
    "navigation_timeout": 30000,
    "max_concurrent_workers": 1,
    "humanoidEnabled": true,
    "humanoidSensitivity": "medium",
    "variables": [
      {
        "name": "csv_data",
        "is_list": true,
        "value": [
          "Alice Smith;alice@example.com",
          "Bob Jones;bob@example.com",
          "Carol White;carol@example.com"
        ]
      }
    ]
  },
  "datasets": {
    "csv_rows": {
      "item_selector": "css=#csv-entries tbody tr",
      "properties": [
        {
          "name": "name",
          "type": "text",
          "selector": "css=.csv-entry-name"
        },
        {
          "name": "email",
          "type": "text",
          "selector": "css=.csv-entry-email"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/forms/6"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=#csv-form"
      }
    },
    {
      "command": "for_each",
      "params": {
        "source_type": "variable",
        "variable": "csv_data",
        "as": "row",
        "do": [
          {
            "command": "fill",
            "params": {
              "selector": "css=#csv-name",
              "value": "${row.split(';')[0].trim()}"
            }
          },
          {
            "command": "fill",
            "params": {
              "selector": "css=#csv-email",
              "value": "${row.split(';')[1].trim()}"
            }
          },
          {
            "command": "wait_for_selector",
            "params": {
              "selector": "css=#csv-submit"
            }
          },
          {
            "command": "click",
            "params": {
              "selector": "css=#csv-submit"
            }
          },
          {
            "command": "wait",
            "params": {
              "timeout": 1000
            }
          },
          {
            "command": "wait_for_selector",
            "params": {
              "selector": "css=#csv-reset"
            }
          },
          {
            "command": "click",
            "params": {
              "selector": "css=#csv-reset"
            }
          }
        ]
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=#csv-entries"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "csv_rows"
      }
    }
  ]
}
  

RTILA X Concepts

This pattern uses a for_each loop over a semicolon-delimited list variable. Each row is split, trimmed, inserted into the form, submitted, and then the form is reset for the next row.

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?