How to Bypass CAPTCHAs With Python

Explore the top techniques and best tools for bypassing CAPTCHAs in Python, and learn how to automate CAPTCHA solutions.
9 min read
How to bypass CAPTCHAs with Python blog image

In this tutorial, you will discover:

  • What CAPTCHAs are
  • Whether they can be automated in Python
  • What to keep in mind when evaluating CAPTCHA bypass Python solutions
  • Top 5 techniques for bypassing CAPTCHAs in Python
  • The best Python CAPTCHA solvers

Let’s dive in!

CAPTCHAs: Definition and Types

A CAPTCHA, short for “Completely Automated Public Turing test to tell Computers and Humans Apart,” is a challenge embedded in a web page, app, or software to distinguish between human users and bots. It typically involves tasks that are easy for humans to solve but difficult for automated software. 

The goal of CAPTCHAs is to prevent automated systems from accessing or interacting with websites or services. Keeping them effective has become increasingly challenging, particularly with the recent advancements in AI and neural networks. That has made anti-bot challenges more complex. 

Now, let’s explore the most popular types of CAPTCHAs currently in use.

Text CAPTCHAs

Text-based CAPTCHAs are the most traditional form of CAPTCHA. They present a distorted string of characters and numbers that users must correctly identify and input. The challenge for automated bots is that they often struggle with recognizing distorted or obscured text.

These types of CAPTCHAs are now easier to solve by bots and have become less popular.

Image CAPTCHAs

Image-based CAPTCHAs require users to identify certain objects or patterns within a series of images. In most cases, users are presented with a grid of images and must click on all images that contain a specific object, such as traffic lights, bicycles, buses, or motorcycles.

A popular provider of these CAPTCHAs is reCAPTCHA.

Sound CAPTCHAs

Sound-based CAPTCHAs are generally an accessibility option for users who may have difficulty with visual CAPTCHAs. These CAPTCHAs provide an audio clip of distorted speech that the user must listen to and transcribe correctly.

Puzzle CAPTCHAs

Puzzle CAPTCHAs task users with solving a simple puzzle to prove they are human. These puzzles can range from jigsaw puzzles to logic-based challenges. For example, users might be tasked with dragging an image into its correct position or placing a dot at the end of a visual path.

Puzzle-CAPTCHA-example

Well-known providers for these creative CAPTCHAs are AWS WAF CAPTCHA and hCaptcha.

Is It Possible To Automate CAPTCHAs Using Python?

CAPTCHAs are specifically designed to be hard to automate, and there is no simple solution to solve them in Python. However, you can try to automate them by following one or both of these two approaches:

  • Avoid CAPTCHAs: Mimic human behavior in a controlled browser with a real-world fingerprint to avoid catching the attention of anti-bots, reducing the likelihood of CAPTCHA occurrence.
  • Rely on CAPTCHA solving services: Outsource CAPTCHAs to premium online services that use AI, advanced automation tools, and/or human workers to solve CAPTCHA challenges.

What tool do you need to perform these two methods? A Python CAPTCHA solver and/or bypass solution!

Aspects to Consider When Evaluating CAPTCHA Bypass Python Solutions

Here are the main elements to examine when comparing the best CAPTCHA bypass Python services on the market:

  • Capabilities: The features and functionality provided by the solution.
  • Nature: Whether the tool is open source or premium.
  • Uptime: The percentage of availability guaranteed by the provider.
  • Success rate: The ability to solve CAPTCHA challenges, expressed as a percentage.
  • CAPTCHA bypass strategy: Whether the solution avoids CAPTCHAs, solves them, or both.
  • Supported CAPTCHA providers: The list of all CAPTCHA providers the service can handle.
  • Trustpilot score: The average score of reviews left by users on Trustpilot.
  • Pricing: The cost of the Python CAPTCHA solver.

CAPTCHA Bypass in Python: Top 5 Approaches

Time to explore the list of the top 5 solutions for bypassing CAPTCHAs in Python, selected and ranked based on the criteria mentioned above!

1. CAPTCHA Solver from Web Unlocker

Bright Data's CAPTCHA Solver page

CAPTCHA Solver is a solution by Bright Data to seamlessly bypass CAPTCHAs from a long list of providers. This tool mimics human-like behavior and browser fingerprints to evade CAPTCHAs and leverage AI-powered algorithms to solve them.

CAPTCHA Solver is part of Web Unlocker, an all-in-one web unlocking API that offers:

  • IP rotation: Dynamically change IP addresses to avoid detection and blocking.
  • Automatic retries: Ensure successful results by retrying requests multiple times for you.
  • JavaScript rendering: Processe dynamic sites using JavaScript for data extraction.
  • Global coverage: Access localized content from any geographic location.
  • High scalability: Support for large-scale data scraping.
  • Referral headers: Simulate traffic from trusted sites by setting real-world referral headers.
  • Cookies handling: Manage cookies to prevent blocks due to cookie-related factors.

As an API, Web Unlocker with CAPTCHA Solver can be accessed from any browser automation or HTTP client in any programming language, including Python. Discover how to bypass CAPTCHAs using Web Unlocker.

These capabilities make CAPTCHA Solver the best solution for bypassing CAPTCHAs in Python. You can try it for free or purchase one of the available plans, starting at $3/CPM ($0.003 per API call). Note that you are charged only for successful requests, which are nearly all thanks to an impressive 99% success rate.

Thanks to these solutions, Bright Data ensures efficient and ethical web scraping practices without interruptions or restrictions.

  • Capabilities: CAPTCHA solving, anti-bot bypass, browser fingerprinting management, IP rotation via proxy integration, automatic request retries, automatic user agent rotation, cookie handling, automatic setting of referral headers, worldwide geo-coverage, JavaScript rendering, data integrity validations, and more
  • Nature: Premium cloud web unlocking API that integrates with any HTTP client in any programming language
  • Uptime: 99.9%
  • Success rate: 99.9%
  • CAPTCHA bypass strategy: CAPTCHAs avoidance via user emulation and fingerprint management + CAPTCHA solving
  • Supported CAPTCHA providers: reCAPTCHA, Click Captcha, hCaptcha, PerimeterX, SimpleCaptcha, FunCaptcha, Cloudflare Turnstile, AWS WAF Captcha, GeeTest CAPTCHA, KeyCAPTCHA, Puzzle Captcha, Yandex Captcha, Image Captcha, Text Captcha, and more
  • Trustpilot score: 4.5/5
  • Pricing: Free trial available, then $3/CPM

2. Playwright Extra with the Stealth Plugin

Playwright stealth plugin

Playwright Extra is a special version of Playwright—the popular browser automation and web scraping tool—that supports plugins. In detail, playwright-stealth is a Python plugin for Playwright Extra that makes automated browsers less detectable by anti-bot mechanisms. 

Inspired by the Puppeteer Extra Stealth Plugin, Playwright Stealth overrides some browser configurations to make it appear more genuine. The end goal is to avoid CAPTCHAs and other anti-bot measures. Check out our guide on how to avoid bot detection using Playwright Stealth.

Read our tutorial on how to bypass CAPTCHAs with Playwright

  • Capabilities: Complete browser automation API, support for JavaScript and Python, anti-bot bypass, E2E testing API, plugin support, debugging capabilities, and more
  • Nature: Open source
  • Uptime: Not applicable
  • Success rate: Unknown
  • CAPTCHA bypass strategy: CAPTCHAs avoidance via user emulation and real-world fingerprint setting
  • Supported CAPTCHA providers: Basic anti-bot CAPTCHAs
  • Trustpilot score: Not applicable
  • Pricing: Free

3. AntiCaptcha

Image of the AntiCaptcha service

AntiCaptcha is a well-known CAPTCHA bypass service, in business since 2007. It offers a wide range of CAPTCHA solving services, all accessible via web endpoints. The provider features a robust API, seamless browser plugin integration, and support for automation tools like Selenium and Puppeteer.

All CAPTCHAs are solved by human workers, with integration in several programming languages available through official libraries. Specifically, python-anticaptcha is the AntiCaptcha solution for Python. Note that the last release of the library was in 2022, no free trial is available, and the success rate is undisclosed.

  • Capabilities: CAPTCHA solving, browser plugin for automatic CAPTCHA solving, APIs to get useful stats and reports 
  • Nature: Premium CAPTCHA bypass APIs for PHP, Python, Java, C#, JavaScript, Go, Ruby
  • Uptime: 99.99%
  • Success rate: Undisclosed
  • CAPTCHA bypass strategy: CAPTCHA solving through human workers
  • Supported CAPTCHA providers: Generic Image CAPTCHA, reCAPTCHA v2, reCAPTCHA v3, reCAPTCHA Enterprise v2/v3, hCaptcha, GeeTest, Arkose Labs, Cloudflare Turnstile
  • Trustpilot score: 4.8/5
  • Pricing: From $0.50/CPM to $2/CPM

4. Selenium with the Stealth Library

Selenium stealth library

Selenium is a powerful browser automation tool widely used for testing and web scraping. It provides a consistent and complete API to automate browsers and mimic user behavior. However, Selenium is often detected by anti-bot technologies due to the way it configures browsers.

selenium-stealth is a Python package specifically designed to make Selenium more stealthy. The library configures Chrome to avoid most detections, enabling smoother automation and higher success rates in several automation tasks. One common use case for Selenium Stealth is bypassing CAPTCHAs in Python.

Find out more in our tutorial on how to bypass CAPTCHAs with Selenium in Python.

  • Capabilities: Complete browser automation API, anti-bot bypass, E2E testing API, and more
  • Nature: Open source
  • Uptime: Not applicable
  • Success rate: Unknown
  • CAPTCHA bypass strategy: CAPTCHAs avoidance via user emulation and real-world fingerprint setting
  • Supported CAPTCHA providers: Basic anti-bot CAPTCHAs
  • Trustpilot score: Not applicable
  • Pricing: Free

5. 2Captcha

Image of the 2Captcha service

2Captcha is a human-based CAPTCHA solving service designed to automate the CAPTCHA bypass process. It supports a wide range of challenges and operates by distributing CAPTCHAs to human workers who solve them in real time. 

2Captcha offers API integration, with official libraries available for various programming languages. In particular, the 2Captcha package for Python CAPTCHA bypass is 2captcha-python.

Note that the provider does not offer any kind of free testing or trial period. Thus, if you do want to test its services you must deposit at least $1. Plus, there are a few concerning reviews on Trustpilot, and the success rate and uptime are not disclosed.

  • Capabilities: CAPTCHA solving
  • Nature: Premium CAPTCHA bypass API for Python, PHP, Java, C++, C#, Go, and Ruby
  • Uptime: Undisclosed
  • Success rate: Undisclosed
  • CAPTCHA bypass strategy: CAPTCHA solving via human workers
  • Supported CAPTCHA providers: Generic CAPTCHA, Generic Text CAPTCHA, Generic Click CAPTCHA, Generic Rotate CAPTCHA, reCAPTCHA V2 Callback, KeyCAPTCHA, reCAPTCHA V2 Invisible, Capy Puzzle CAPTCHA, Cloudflare Turnstile, Amazon CAPTCHA, Audio CAPTCHA, MTCaptcha, DataDome CAPTCHA, CyberSiARA CAPTCHA, Cutcaptcha, Friendly CAPTCHA, Russian CAPTCHA, Chinese CAPTCHA, Number CAPTCHA, Math CAPTCHA, Slider CAPTCHA, Tencent Captcha, atbCAPTCHA
  • Trustpilot score: 4.0/5
  • Pricing: From $0.50/CPM to $50/CPM

Best Python CAPTCHA Solver

The summary table below summarizes what the top Python CAPTCHA solver solutions have to offer:

Service Features Programming Languages Uptime Success Rate CAPTCHA Avoidance CAPTCHA Solving Review Score Free Trial Pricing
Bright Data CAPTCHA Solver Tons Any 99.9% 99.9% ✔️ ✔️ 4.5/5 check mark $3/CPM
Playwright Stealth Many Python, JavaScript Unknown ✔️ Free
AntiCaptcha Few Python, PHP, Java, C#, JavaScript, Go, Ruby 99.99% Undisclosed ✔️ 4.8/5 cross mark $0.50/CPM — $2/CPM
Selenium Stealth Many Python Unknown ✔️ Free
2Captcha Almost none Python, PHP, Java, C++, C#, Go, Ruby Undisclosed Undisclosed ✔️ 4.0/5 cross mark $0.50/CPM — $50/CPM

Conclusion

In this article, you saw why CAPTCHAs pose a challenge for automated software and explored whether automating them is feasible in Python. You also discovered the list of the top Python CAPTCHA solver solutions.

As highlighted here, Web Unlocker stands out as the best unblocking API for getting CAPTCHA-free HTML from any web page. This scraping API handles browser fingerprinting, offers automatic retries, and integrates proxies to rotate exit IPs with each request, also dealing with CAPTCHA resolution for you. Automating CAPTCHAs in Python has never been easier!

Want to skip the hassle completely? Check out the dataset marketplace and download free samples. Register now and start your free trial today.

No credit card required