authentication Scenario 2 — Check Login Form Visibility Before Acting
Written by RTILA X Engineering Team
Beginner ~4 min
What You'll Learn
Check if a login form is visible before interacting
Real-World Use Case
Handling pages that may already be authenticated
LIVE DEMO
Conditionally Visible Login
The form is shown only when the user is logged out. An if check decides whether to interact.
EXPECTED OUTPUT
Conditional Login Profile Data
| label | value |
|---|---|
| user@test.com | |
| Role | Admin |
| Member Since | 2024-03-15 |
RTILA X PROJECT JSON
RTILA X Automation Project
check-login-form-visibility.json
{
"name": "Check_Login_Form_Visibility",
"settings": {
"urls": [
"https://learn.rtila.com/scenarios/authentication/2"
]
},
"datasets": {
"profile_data": {
"item_selector": "css=.dashboard-content table tr",
"properties": [
{
"name": "label",
"type": "text",
"selector": "css=td:first-child"
},
{
"name": "value",
"type": "text",
"selector": "css=td:last-child"
}
]
}
},
"commands": [
{
"command": "goto",
"params": {
"url": "https://learn.rtila.com/scenarios/authentication/2"
}
},
{
"command": "if",
"params": {
"condition": {
"type": "element_visible",
"selector": "css=.login-form"
},
"then": [
{
"command": "fill",
"params": {
"selector": "css=#cond-username",
"value": "user@test.com"
}
},
{
"command": "fill",
"params": {
"selector": "css=#cond-password",
"value": "secret"
}
},
{
"command": "click",
"params": {
"selector": "css=#cond-login-btn"
}
},
{
"command": "wait_for_selector",
"params": {
"selector": "css=.dashboard-content"
}
},
{
"command": "extract_data",
"params": {
"dataset": "profile_data"
}
}
]
}
}
]
}
RTILA X Concepts
The if command uses element_visible to branch based on
current DOM state. This prevents automation from failing when the login form has
already been replaced by authenticated content.
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!