loops Scenario 6 — Extract Table Rows
Written by RTILA X Engineering Team
Advanced ~10 min
Prerequisites: loops/3 loops/4 loops/5
What You'll Learn
Extract table rows using nth-child selectors
Real-World Use Case
Exporting tabular data to CSV
LIVE DEMO
| Name | Role | Join Date | |
|---|---|---|---|
| techguru42 | techguru42@example.com | admin | 2023-05-18 |
| dataminer_sam | sam.data@example.com | admin | 2023-08-01 |
| scraper_queen | queen@scrape.example | editor | 2024-01-12 |
| automation_alice | alice.auto@example.com | editor | 2024-02-20 |
| selector_sam | selector.sam@example.com | editor | 2024-03-09 |
| css_crusader | css.crusader@example.com | editor | 2024-04-14 |
| json_jess | jess.json@example.com | editor | 2024-05-22 |
| xpath_xavier | xavier.xpath@example.com | viewer | 2024-06-02 |
| dom_dave | dave.dom@example.com | viewer | 2024-06-18 |
| puppeteer_paul | paul.puppet@example.com | viewer | 2024-07-03 |
EXPECTED OUTPUT
RTILA X PROJECT JSON
{
"name": "Extract_Table_Rows",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/loops/6"
]
},
"datasets": {
"users": {
"item_selector": "css=table.data-table tr",
"properties": [
{
"name": "name",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "email",
"type": "text",
"selector": "css=td:nth-child(2)"
},
{
"name": "role",
"type": "text",
"selector": "css=td:nth-child(3)"
},
{
"name": "join_date",
"type": "text",
"selector": "css=td:nth-child(4)"
}
]
}
},
"commands": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=table.data-table"
}
},
{
"command": "extract_data",
"params": {
"dataset": "users"
}
}
]
}
RTILA X Concepts
Tables are common iteration targets. The dataset uses the table row selector and extracts each column using nth-child.
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?
Thank you for your feedback!