Skip to main content

conditional-logic Scenario 6 — Detect and Solve CAPTCHA

Written by RTILA X Engineering Team

Advanced ~10 min
Prerequisites: conditional-logic/3 conditional-logic/4 conditional-logic/5

What You'll Learn

Detect and solve captchas conditionally

Real-World Use Case

Bypassing bot protection on login pages

LIVE DEMO

CAPTCHA Detection

Solve the CAPTCHA when it appears, then extract the protected table.

Verify You Are Human

EXPECTED OUTPUT

Protected Rows

record field value
1 Email alpha@example.com
2 Phone +1 (555) 0101
3 Plan Enterprise
4 Status Active
5 Last Login 2025-03-12
RTILA X PROJECT JSON

RTILA X Automation Project

detect-and-solve-captcha.json
{
  "name": "Detect_And_Solve_Captcha",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/conditional-logic/6"
    ]
  },
  "datasets": {
    "protected_rows": {
      "item_selector": "css=.protected-content table tbody tr",
      "properties": [
        {
          "name": "record",
          "type": "text",
          "selector": "css=td:nth-child(1)"
        },
        {
          "name": "field",
          "type": "text",
          "selector": "css=td:nth-child(2)"
        },
        {
          "name": "value",
          "type": "text",
          "selector": "css=td:nth-child(3)"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "if",
      "params": {
        "condition": {
          "type": "element_visible",
          "selector": "css=#captcha-container"
        },
        "then": [
          {
            "command": "fill",
            "params": {
              "selector": "css=#captcha-input",
              "value": "DEMO"
            }
          },
          {
            "command": "wait_for_selector",
            "params": {
              "selector": "css=#captcha-submit"
            }
          },
          {
            "command": "click",
            "params": {
              "selector": "css=#captcha-submit"
            }
          },
          {
            "command": "wait_for_selector",
            "params": {
              "selector": "css=.protected-content"
            }
          },
          {
            "command": "extract_data",
            "params": {
              "dataset": "protected_rows"
            }
          }
        ],
        "else": [
          {
            "command": "wait_for_selector",
            "params": {
              "selector": "css=.protected-content"
            }
          },
          {
            "command": "extract_data",
            "params": {
              "dataset": "protected_rows"
            }
          }
        ]
      }
    }
  ]
}

CAPTCHA challenges can be detected with element_visible. The automation fills the answer, submits the form, waits for the protected content, and then extracts the table.

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?