How to Bypass CAPTCHA in Web Scraping Using Python?

Follow Us:

Completely Automated Public Turing tests to tell Computers and Humans Apart (CAPTCHAs) were introduced in the early 2000s as a security technique to identify unusual internet activity. A CAPTCHA helps cybersecurity analysts guard web servers against malicious automated attacks such as distributed denial-of-service (DDoS) and prevents unwanted web scraping by bots. While CAPTCHAs can be handled manually, doing so is time-consuming and costly for businesses that rely on web data extraction at scale.

The ability to bypass CAPTCHAs programmatically is highly beneficial as it enables automating tasks and extracting data efficiently from websites protected by these security measures. Bypassing CAPTCHAs opens up opportunities for businesses to collect and analyze web data crucial for making informed decisions. This article will guide you through bypassing CAPTCHAs using the Python programming language.

How Can You Bypass CAPTCHAs with Web Unblocker using Python?

CAPTCHAs can be a real hassle for anyone trying to collect data from websites. They pop up unexpectedly and halt scraping efforts until you pass the test. This can slow down analysis and decision-making processes, which is frustrating for companies. You can use ZenRows’ Web Unblocker to bypass CAPTCHAs seamlessly. Here’s how: 

1. Install prerequisites

Ensure you have the right tools along with Python packages: requests, to send web requests, and beautifulsoup4, to navigate and extract data from HTML. You can easily install them using pip, which usually comes with Python.

2. Inspect your target site

Imagine you want to gather information from a bookstore website called “The Dog Island” ( You need to get every book title now.

To accomplish this, you must comprehend the layout of the website.

Examine the HTML code and take a behind-the-scenes look using the browser’s developer tools. For instance, book titles are usually contained within the <a> tags under the <h3> tags.

3. Set up the Web Unblocker endpoint

Set up the Web Unblocker endpoint in Python to help bypass certain online restrictions. The first step is  to import the necessary libraries. Next, create a dictionary called web_unblocker to store the necessary information for accessing the Web Unblocker service. This includes your sub-user’s credentials and the endpoint URL.  This dictionary will be used later to make requests through the Web Unblocker.

4. Send a request to the target

Sending a request to the destination website is required to use Python and Web Unblocker to get around CAPTCHA. When interacting with Web Unblocker, you must bypass the SSL certificate verification since the web Unblocker might not have a valid SSL certificate.

5. Parse the required  data

Now that you’ve successfully accessed the blocked website using the Web Unblocker, extract the information you need using the BeautifulSoup library in Python.

First, create a soup object to store the HTML content. Next, create a loop to extract all the titles from the page. Target the <h3> tags and their corresponding <a> tags that contain the titles.

Use the CSS expressions to select all the <a> tags inside the <h3> tags. Each title is stored as a value of the “title” attribute within the <a> tag. Retrieve these titles using the .get() function.

Using Python and Selenium to Bypass CAPTCHA

Ensure you have Python in your system. You can download it from the official site. Make sure to get the newest version or anything above 3.6. This is crucial because older versions might not fully support undetected Chrome drivers, which you’ll need later on.

Step 1: Install dependencies

Firstly, you must have Python installed on your computer. If not, download it from the official Python website. Make sure to get the latest version or one that’s 3.6 or higher for compatibility.

After installing Python, open your command prompt or terminal and install two important modules: undetected-chrome driver and requests.

Step 2: Import libraries

Now is the time to set up your Python environment with the tools you have. Start by importing the relevant libraries into your Python script. This prepares your Python script to work with the Chrome browser invisibly, without opening a visible window.

Step 3: Browse the web page

Go to the website where you want to get the CAPTCHA now.

Step 4: Wait for CAPTCHA to load

Wait for some time until the CAPTCHA loads.

Step 5: Solve CAPTCHA

After the CAPTCHA has been loaded, now is the time to solve the CAPTCHA.

Step 6: Fill the CAPTCHA input field with the solved token

After the CAPTCHA has been solved, now is the time to fill the CAPTCHA input field with the solved token.

Step 7: Submit CAPTCHA

Now is the time to submit the CAPTCHA with. Once CAPTCHA is bypassed, you can proceed with scraping or interacting with the website.

Step 8: Take a screenshot

To verify that the webpage has loaded correctly without displaying any CAPTCHA or bot protection prompts, you can capture a screenshot.

Developing Your Own Solution

Creating your solution to handle complex CAPTCHAs is possible although it requires time and effort. There are a few tools, such as Playwright and Puppeteer, that can assist you. However, these tools may have limitations in terms of browser compatibility or require significant development effort.


Playwright is a tool crafted by Microsoft, tailored for web examination and automation tasks. It boasts versatility, accommodating renowned programming languages such as Python, JavaScript, and Java. Playwright’s prowess extends across Chromium-based, Firefox, and WebKit browsers, offering users a spectrum of options for their activities.


Puppeteer, a tool adept at circumventing CAPTCHAs, can greatly facilitate automated web task automation. While its native framework is JavaScript, Puppeteer extends its functionality to Python. However, a notable limitation is its exclusive compatibility with Chrome-based browsers.


While the steps outlined allow you to interact with web pages and bypass CAPTCHAs using Python, it’s crucial to apply this knowledge strategically. 

For businesses and developers seeking a comprehensive and user-friendly solution to bypass CAPTCHAs ethically, ZenRows offers a compelling alternative. With its advanced AI capabilities, rotating proxies, and CAPTCHA-solving features, ZenRows streamlines the process of navigating CAPTCHA-protected websites across various platforms. Its seamless integration with multiple programming languages and extensive documentation make it an effective tool for web scraping projects of all sizes.

If you’re looking to enhance your web scraping workflow and overcome the hurdles posed by CAPTCHAs, consider exploring ZenRows. Its intuitive API and powerful features can potentially unlock new opportunities for data extraction and analysis.

Also Read: Python vs Java: What’s The Difference?



Subscribe To Our Newsletter

Get updates and learn from the best

Scroll to Top

Hire Us To Spread Your Content

Fill this form and we will call you.