How to bypass reCaptcha V3 using Selenium Python?

* bypass – bypass

We will use the selenium python library to bypass google reCaptcha v3. Follow the step by step instructions to get the result.

For example, we will use the Google reCaptcha api demo.

Here’s the link: https://www.google.com/recaptcha/api2/demo

First, you need to disable the content protection setting in the Chrome browser.

To do this, go to Settings in Chrome. And write “site settings” in the search bar.

Go to site settings and find “Protected Content”.

Go to protected content and disable it.

Now let’s move on to the coding part.

In this tutorial, we will be working with Python 3. We will be using two libraries. If you want to customize Selenium and learn how to do it, check out this article: https://medium.com/@mrabdulbasit1999/selenium-with-python-web-automation-f85dfa2e58fa

Moving on

Install the Beautiful Soup library for the script.

pip install beautifulsoup4

Open the script file and import the mentioned libraries into it.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from http_request_randomizer.requests.proxy.requestProxy 
import RequestProxy
import os, sys
import time,requests
from bs4 import BeautifulSoup

Set “delayTime” and “audioToTextDelay” according to your internet speed. The set values ​​work for everyone.

delayTime = 2
audioToTextDelay = 10

byPassUrl is the URL you need to target. The option is used to select a chrome driver and is passed some arguments.

filename = ‘1.mp3’
byPassUrl = ‘https://www.google.com/recaptcha/api2/demo'
googleIBMLink = ‘https://speech-to-text-demo.ng.bluemix.net/'
option = webdriver.ChromeOptions()
option.add_argument('--disable-notifications')
option.add_argument("--mute-audio")

The rest of the code is shown below. Now I will explain how it works.

When the script runs, the I’m not a robot field is checked.

And then everything appears (as usual).

After the script, the audio button at the bottom left is selected.

And this appears. After that, an audio named “1.mp3” is loaded.

It will take a few seconds, don’t worry. This will open a new tab in the browser which will go from watson speech to text to converter and download the file.

As you can see, the audio file is converted to text. It copies the text and pastes it into the text box.

And then the “Check” button is pressed.

Here, look … Problem solved. If you have any problems or questions, please write. I will answer them as soon as I can.

The code


All readers of our blog are invited to read OTUS testing courses.

Demo Day course “Python QA Engineer”

Demo Day course “Java QA Automation Engineer”

Leave a Reply