conditional-logic Scenario 4 — Detect Access Denied and Handle WAF
Written by RTILA X Engineering Team
Intermediate ~6 min
Prerequisites: conditional-logic/1 conditional-logic/2
What You'll Learn
Chain multiple conditions
Real-World Use Case
Implementing complex sign-up logic
LIVE DEMO
Access Denied
Reference #18.abc123
EXPECTED OUTPUT
RTILA X PROJECT JSON
{
"name": "Detect_And_Handle_WAF",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/conditional-logic/4"
]
},
"datasets": {},
"commands": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=.access-denied"
}
},
{
"command": "if",
"params": {
"condition": {
"type": "script",
"expression": "document.body.innerText.includes('Access Denied')"
},
"then": [
{
"command": "comment",
"params": {
"text": "WAF detected, would rotate proxy"
}
}
],
"else": [
{
"command": "wait_for_selector",
"params": {
"selector": "css=.real-content"
}
},
{
"command": "extract_data",
"params": {
"dataset": "page_data"
}
}
]
}
}
]
}
A script condition reads the page body text. If the WAF block text is present, the automation logs a comment and skips extraction. If not, it extracts the real content from the page.
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?
Thank you for your feedback!