error-handling Scenario 1 — Retry Flaky Page 3 Times
Written by RTILA X Engineering Team
Beginner ~4 min
What You'll Learn
Check element visibility before acting
Real-World Use Case
Avoiding flaky tests on dynamic pages
LIVE DEMO
Flaky Page Retry
A page that shows a loading state for three seconds before data appears.
Loading...
EXPECTED OUTPUT
Flaky Data
| id | product | sku | price |
|---|---|---|---|
| 1 | Wireless Mouse | WM-100 | $24.99 |
| 2 | USB-C Hub | UC-210 | $39.99 |
| 3 | Mechanical Keyboard | MK-330 | $89.99 |
| 4 | 4K Monitor | MO-450 | $329.99 |
| 5 | Webcam | WB-560 | $59.99 |
RTILA X PROJECT JSON
RTILA X Automation Project
retry-flaky-page.json
{
"name": "Retry_Flaky_Page",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/error-handling/1"
]
},
"datasets": {
"flaky_data": {
"item_selector": "css=table.flaky-data tbody tr",
"properties": [
{
"name": "id",
"type": "text",
"selector": "css=td:nth-child(1)"
},
{
"name": "product",
"type": "text",
"selector": "css=td:nth-child(2)"
},
{
"name": "sku",
"type": "text",
"selector": "css=td:nth-child(3)"
},
{
"name": "price",
"type": "text",
"selector": "css=td:nth-child(4)"
}
]
}
},
"commands": [
{
"command": "try_catch",
"params": {
"try": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=.flaky-data",
"timeout": 5000
}
},
{
"command": "extract_data",
"params": {
"dataset": "flaky_data"
}
}
],
"catch": [
{
"command": "wait",
"params": {
"timeout": 5000
}
},
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/error-handling/1"
}
},
{
"command": "extract_data",
"params": {
"dataset": "flaky_data"
}
}
]
}
}
]
} RTILA X Concepts
A try_catch block first waits for the target table with a short timeout. If the element does not appear, the catch branch waits, reloads the page, and attempts extraction again.
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!