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

Verify You Are Human

EXPECTED OUTPUT

RTILA X PROJECT JSON

    {
  "name": "Detect_And_Solve_Captcha",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/conditional-logic/6"
    ],
    "headless": false,
    "navigation_timeout": 30000,
    "max_concurrent_workers": 1,
    "humanoidEnabled": true,
    "humanoidSensitivity": "medium"
  },
  "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": "goto",
      "params": {
        "url": "https://learn.rtila.com/scenarios/conditional-logic/6"
      }
    },
    {
      "command": "wait_for_selector",
      "params": {
        "selector": "css=#captcha-container"
      }
    },
    {
      "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?