
Today, you’ll learn how to use Python 3 and Selenium to bypass CAPTCHA on a website. The full source code of this project is given below.
pip install selenium
from selenium import webdriver
import time
dataset = {' * * * * * ******* ': 'J',
'******* * * * * * *': 'L',
'******** * ** * ** * ** * ** * * ** ** ': 'B',
'* * * **** * * * ': 'Y',
'* * * ******** * * ': 'T',
' ***** * ** ** ** ** * * * ': 'C',
'******** * ** * ** * ** ** ** *': 'E',
'******** ** ** ** ** * ***** ': 'D',
'* ** ** ********* ** ** *': 'I',
' ***** * ** ** ** ** * ***** ': 'O',
'******* * * * * * *******': 'M',
'******* * * * * * *******': 'N',
'******** * * * * * * * * ': 'F',
' ** * * * ** * ** * ** * ** * * * ** ': 'S',
' ***** * ** ** ** * ** * **** *': 'Q',
'******* * * * * * * * * * * *': 'K',
' ** ** ** * * * ** * ** **': 'A',
'****** * * * * ******* ': 'U',
'******* * * * * * *******': 'H',
'** ** ** * ** ** ** ': 'V',
'* ** *** * ** * ** * *** ** *': 'Z',
'******** * * * * * * * * * ** ': 'P',
'* * * * * * * * * * * * *': 'X',
' ***** * ** ** ** * ** * * * ** ': 'G',
'******** * * * * * * ** * * * ** *': 'R',
'******* * * * * * *******': 'W'}
def group_captcha_string(word_pos):
captcha_string = ''
for i in range(len(word_pos[0])):
temp_list = []
temp_string = ''
for j in range(len(word_pos)):
val = word_pos[j][i]
temp_string += val
if val.strip():
temp_list.append(val)
if temp_list:
captcha_string += temp_string
else:
captcha_string += 'sp'
return captcha_string.split("spsp")
# create client
client = webdriver.Chrome()
client.get("http://keith-wood.name/realPerson.html")
time.sleep(3)
# indexing text
_get = lambda _in: {index: val for index, val in enumerate(_in)}
# get text from html tag
captcha = client.find_element_by_css_selector('form [class="realperson-text"]').text.split('\n')
word_pos = list(map(_get, captcha))
# group text
text = group_captcha_string(word_pos)
# get text(test)
captcha_text = ''.join(list(map(lambda x: dataset[x] if x else '', text)))
print("captcha:", captcha_text)Google Chrome has dominated web browsing for over a decade with 71.77% global market share.…
Perplexity just made its AI-powered browser, Comet, completely free for everyone on October 2, 2025.…
You've probably heard about ChatGPT Atlas, OpenAI's new AI-powered browser that launched on October 21,…
Perplexity Comet became free for everyone on October 2, 2025, bringing research-focused AI browsing to…
ChatGPT Atlas launched on October 21, 2025, but it's only available on macOS. If you're…
Two AI browsers just entered the ring in October 2025, and they're both fighting for…