---
title: "How to Bypass CAPTCHA in Selenium: 5 Effective Techniques That Work in 2026"
description: "Learn effective strategies for bypassing CAPTCHAs in web scraping with Selenium. Enhance your skills and streamline your automation."
url: "https://iproyal.com/blog/selenium-bypass-captcha/"
---

- [EN - English](https://iproyal.com/)
   
  [中文 - Chinese](https://iproyal.cn/)

[Book a Demo](https://iproyal.com/request-a-demo/) [Create Account](https://dashboard.iproyal.com/register/) [Create Account](https://dashboard.iproyal.com/register/) [Login](https://dashboard.iproyal.com/login/) [Login](https://dashboard.iproyal.com/login/)

[Book a Demo](https://iproyal.com/request-a-demo/)

[Back to blog](https://iproyal.com/blog/)

# How to Bypass CAPTCHA in Selenium: 5 Effective Techniques That Work in 2026

[Vilius Dumcius](https://iproyal.com/blog/authors/vilius-dumcius/)

[Last updated - April 30, 2025 ‐ 5 min read](https://iproyal.com/blog/authors/vilius-dumcius/)

[Selenium](https://iproyal.com/blog/category/selenium/)

CAPTCHA is a security feature meant to stop bots. It tells humans and bots apart by showing puzzles like clicking images or typing distorted text. These puzzles are meant to **stop web scrapers and automated scripts from accessing a web page too fast or too often.**

That’s where the trouble begins for developers who use Selenium. If you’re trying to do web scraping or automation testing, **you’ll often hit a Selenium CAPTCHA bypass wall.**

Before we start on how you can bypass CAPTCHA, let’s pause for a second. Some sites don’t want bots, and that’s their choice. **Always follow the law and check a site’s terms of service before running a Selenium script.**

## 1. Use Anti-CAPTCHA Services

Anti-CAPTCHA services help handle CAPTCHA in Selenium by solving them with either AI or real people. **These services act like human users and send back the answer.**

The logic behind this process is: you create a task specifying the CAPTCHA type, send the image or challenge to the API, and then retrieve the solution.

### Python Example with Selenium

First, **make sure you have the right packages installed.&#x20;**&#x54;hen, adjust the pseudocode below with the necessary arguments with the ones of your target website:

```python
import requests
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

# Set up Selenium
driver = webdriver.Chrome()
driver.get("https://example.com")

# Locate and screenshot the CAPTCHA image
captcha_element = driver.find_element(By.ID, 'captcha_image')
captcha_element.screenshot("captcha.png")

# Read the image file
with open("captcha.png", "rb") as image_file:
    image_base64 = image_file.read().encode("base64") if hasattr(image_file, "encode") else image_file.read().decode("latin1")

# Anti-Captcha API key
api_key = "YOUR_API_KEY"

# 1. Create a task
create_task_payload = {
    "clientKey": api_key,
    "task": {
        "type": "ImageToTextTask",
        "body": image_base64
    }
}
create_task_response = requests.post("https://api.anti-captcha.com/createTask", json=create_task_payload).json()
task_id = create_task_response.get("taskId")

# 2. Poll for result
solution = None
if task_id:
    for _ in range(20):  # Max ~20s
        time.sleep(5)
        get_result_payload = {
            "clientKey": api_key,
            "taskId": task_id
        }
        result = requests.post("https://api.anti-captcha.com/getTaskResult", json=get_result_payload).json()
        if result.get("status") == "ready":
            solution = result["solution"]["text"]
            break

# 3. Use the solution in the form
if solution:
    driver.find_element(By.ID, "captcha_input").send_keys(solution)
else:
    print("CAPTCHA solution not retrieved.")
```

You must still **detect the CAPTCHA element correctly,&#x20;**&#x77;hich could sometimes be tricky.

**Pros:**

- High success rate
- Works well on image-based CAPTCHA challenges

**Cons:**

- Not a free option
- Delay due to response time

This method works best **if you hit CAPTCHA challenges often and need quick solutions.**

## 2. Use Undetected-ChromeDriver or Stealth Plugins

Some sites can detect if you’re using Selenium. That’s where Selenium stealth tools come in. **They make the browser look like it’s being used by human users,&#x20;**&#x6E;ot a bot.

It’s a custom version of ChromeDriver that avoids detection by making small changes, like **hiding the Selenium import webdriver traces or adjusting window settings.&#x20;**&#x48;ere’s an example setup:

```python
import undetected_chromedriver as uc

options = uc.ChromeOptions()
options.add_argument("--disable-blink-features=AutomationControlled")
driver = uc.Chrome(options=options)
```

You’ll first need to **install *undetected\_chromedriver*,&#x20;**&#x74;hough:

```python
pip install undetected-chromedriver
```

So, can Selenium bypass CAPTCHA? With Selenium stealth plugins, **the site may not even show any CAPTCHAs.&#x20;**&#x49;f using it, you should do it when CAPTCHA appears even before logging in. Or when sites block you fast due to bot activity.

It won’t always bypass CAPTCHA, but **it lowers the chance of getting one.**

## 3. Rotate Proxies and User Agents

Some sites block based on your IP or user agent string. **Using a rotating Selenium proxy and different headers helps you blend in better.**

Sites track patterns, and if the same IP makes a lot of requests, it signals that it could be a bot. **A rotating proxy prevents that.&#x20;**&#x48;ere’s a code snippet for proxy rotation:

```python
from selenium import webdriver

proxy = "your.proxy.ip:port"
user_agent = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36"

options = webdriver.ChromeOptions()
options.add_argument(f'--proxy-server={proxy}')
options.add_argument(f'user-agent={user_agent}')

driver = webdriver.Chrome(options=options)
```

Make sure your Selenium import webdriver section is **correct for your browser.&#x20;**&#x49;t won’t always handle CAPTCHA in Selenium perfectly, but it keeps you from getting blocked too fast or too often.

To excel at this method, you should check out [residential proxies ](https://iproyal.com/residential-proxies/)that will help you out.

## 4. Leverage CAPTCHA-Solving Browser Extensions

Another way to handle CAPTCHA in Selenium is by using browser extensions. **These run in the background and solve CAPTCHAs for you.**

You can load an extension like [Buster ](https://chromewebstore.google.com/detail/buster-captcha-solver-for/mpbjkejclgfgadiemmefgebjfooflfhl?hl=en)(for reCAPTCHA) into Chrome like this:

```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_extension('path/to/buster.crx')
driver = webdriver.Chrome(options=chrome_options)
```

Note that it’s not a 100% perfect solution. **Sometimes it could work, other times not that much.&#x20;**&#x54;his method also has some limitations, such as:

- Only works for some types of CAPTCHAs.
- Can break after updates.
- Doesn’t support headless mode very well.

Still, it’s a lightweight way to bypass CAPTCHA in some simpler setups.

## 5. Train Your Own Solver

Now, if you’re looking for full control, you can **build your own solver using OCR or machine learning.&#x20;**&#x54;ools like Tesseract can read text from CAPTCHA images. You’ll need to extract the CAPTCHA element, clean the image, and let OCR read it.

However, this method could be an overkill. It’s heavy. **You’ll spend more time training models than solving CAPTCHAs yourself.&#x20;**&#x4F;nly use this, if:

- You’re solving the same CAPTCHA format every time.
- Other tools don’t work that well for you.
- Your target has advanced protection that makes it too difficult to bypass CAPTCHA with other methods.
- You enjoy the challenge of building new solutions.

It might work in headless mode, but **you must test it first.&#x20;**&#x41;lso, if you’re doing automation testing, this might be too much.

## Conclusion

To wrap it up, there are several ways to bypass CAPTCHA with Selenium. You can use anti-CAPTCHA APIs, try Selenium stealth tools, rotate IPs and user agent strings with a rotating proxy, add browser extensions, or build your own solver.

Some of these methods support headless browsers, some won’t give the desired results in headless mode. No single trick works every time, and you’ll need to mix and match depending on the site.

Don’t miss our [guide on Selenium and Python ](https://iproyal.com/blog/web-scraping-with-selenium-and-python/).

[Create Account](https://dashboard.iproyal.com/)

[Author](https://iproyal.com/blog/authors/vilius-dumcius/)

[Vilius Dumcius](https://iproyal.com/blog/authors/vilius-dumcius/)

[Head of Engineering](https://iproyal.com/blog/authors/vilius-dumcius/)

With six years of programming experience, Vilius specializes in full-stack web development with PHP (Laravel), MySQL, Docker, Vue.js, and Typescript. Managing a skilled team at IPRoyal for years, he excels in overseeing diverse web projects and custom solutions. Vilius plays a critical role in managing proxy-related tasks for the company, serving as the lead programmer involved in every aspect of the business. Outside of his professional duties, Vilius channels his passion for personal and professional growth, balancing his tech expertise with a commitment to continuous improvement.

[Learn More About Vilius Dumcius ](https://iproyal.com/blog/authors/vilius-dumcius/)[Meet all Writers](https://iproyal.com/blog/authors/)

Share on

### In This Article

- [1. Use Anti-CAPTCHA Services](https://iproyal.com/blog/selenium-bypass-captcha/#1.-Use-Anti-CAPTCHA-Services)
- [2. Use Undetected-ChromeDriver or Stealth Plugins](https://iproyal.com/blog/selenium-bypass-captcha/#2.-Use-Undetected-ChromeDriver-or-Stealth-Plugins)
- [3. Rotate Proxies and User Agents](https://iproyal.com/blog/selenium-bypass-captcha/#3.-Rotate-Proxies-and-User-Agents)
- [4. Leverage CAPTCHA-Solving Browser Extensions](https://iproyal.com/blog/selenium-bypass-captcha/#4.-Leverage-CAPTCHA-Solving-Browser-Extensions)
- [5. Train Your Own Solver](https://iproyal.com/blog/selenium-bypass-captcha/#5.-Train-Your-Own-Solver)
- [Conclusion](https://iproyal.com/blog/selenium-bypass-captcha/#Conclusion)

Ready to get started?

[Register now](https://dashboard.iproyal.com/register/)

Data News in Your Inbox

No spam whatsoever, just pure data gathering news, trending topics and useful links. Unsubscribe anytime.

No spam. Unsubscribe anytime.

## Related articles

[View all](https://iproyal.com/blog/category/selenium/)

[Selenium](https://iproyal.com/blog/headless-firefox-python-selenium/)

## [How to Run Headless Firefox with Python Selenium](https://iproyal.com/blog/headless-firefox-python-selenium/)

[Find out how to run Firefox in headless mode with Selenium and when that’s useful to do when scraping or automating browsers.](https://iproyal.com/blog/headless-firefox-python-selenium/)

[August 19, 2024](https://iproyal.com/blog/headless-firefox-python-selenium/)

[5 min read](https://iproyal.com/blog/headless-firefox-python-selenium/)

[Selenium](https://iproyal.com/blog/selenium-stealth-python-tutorial/)

## [Mastering Selenium Stealth for Effective Web Scraping Techniques](https://iproyal.com/blog/selenium-stealth-python-tutorial/)

[Tired of getting blocked while scraping? Discover how to use Selenium Stealth to outsmart bot detection and browse like a real user—undetected and uninterrupted.](https://iproyal.com/blog/selenium-stealth-python-tutorial/)

[June 17, 2025](https://iproyal.com/blog/selenium-stealth-python-tutorial/)

[13 min read](https://iproyal.com/blog/selenium-stealth-python-tutorial/)

[Selenium](https://iproyal.com/blog/selenium-find-element/)

## [How to Find Elements in Selenium: A Beginner’s Guide with Examples](https://iproyal.com/blog/selenium-find-element/)

[Learn how to find elements in Selenium using Python. Discover locator types, code examples, and tips for locating web elements on any web page.](https://iproyal.com/blog/selenium-find-element/)

[December 16, 2025](https://iproyal.com/blog/selenium-find-element/)

[5 min read](https://iproyal.com/blog/selenium-find-element/)
