I’m automating a login flow on a website using Python (Requests/Selenium) and encountered a CAPTCHA consisting of a simple math expression. After several attempts, the server displays expressions such as 3 + 7 * 2 = ?, sometimes rendered as plain text and sometimes as an image.
I’d like to automate handling this CAPTCHA in an authorized environment: extract the expression, evaluate it safely, and submit the result so the login flow can continue. I understand eval() can compute expressions, but I’m unsure of the best practices for securely extracting the CAPTCHA text and submitting the computed value.
If the expression is rendered as an image, is OCR or a third-party recognition service required? I’d also like an overview of common approaches (text parsing, OCR, external services), their reliability, typical costs, and practical integration considerations.