error-handling Scenario 2 — Fallback Selector on Extraction Failure
Written by RTILA X Engineering Team
Beginner ~4 min
What You'll Learn
Assert computed styles to verify UI state
Real-World Use Case
Validating that a hidden element is truly hidden
LIVE DEMO
| ID | Name | Status |
|---|---|---|
| 1 | Project Alpha | Active |
| 2 | Project Beta | Pending |
| 3 | Project Gamma | Active |
| 4 | Project Delta | Paused |
| 5 | Project Epsilon | Active |
EXPECTED OUTPUT
RTILA X PROJECT JSON
{
"name": "Fallback_Selector_Extraction",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/error-handling/2"
],
"headless": false,
"navigation_timeout": 30000,
"max_concurrent_workers": 1,
"humanoidEnabled": true,
"humanoidSensitivity": "medium"
},
"datasets": {
"fallback_data": {
"item_selector": "css=.data-table",
"properties": [
{
"name": "id",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "name",
"type": "text",
"selector": "css=td:nth-child(2)"
},
{
"name": "status",
"type": "text",
"selector": "css=td:nth-child(3)"
}
]
},
"fallback_data_legacy": {
"item_selector": "css=.legacy-table",
"properties": [
{
"name": "id",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "name",
"type": "text",
"selector": "css=td:nth-child(2)"
},
{
"name": "status",
"type": "text",
"selector": "css=td:nth-child(3)"
}
]
}
},
"commands": [
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/error-handling/2"
}
},
{
"command": "try_catch",
"params": {
"try": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=.data-table",
"timeout": 5000
}
},
{
"command": "extract_data",
"params": {
"dataset": "fallback_data"
}
}
],
"catch": [
{
"command": "comment",
"params": {
"text": "Primary selector failed, using fallback"
}
},
{
"command": "extract_data",
"params": {
"dataset": "fallback_data_legacy"
}
}
]
}
}
]
}
RTILA X Concepts
When a primary selector is missing, the catch block can execute a fallback extraction using an alternative selector. This keeps the automation running even when the DOM changes.
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 1 RTILA X command and is referenced in 1 learning article.
Continue Learning
Was this helpful?
Thank you for your feedback!