I got tired of bot detection in automation testing, so I wrote this 4-line Python fix

Published: (December 2, 2025 at 03:37 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for I got tired of bot detection in automation testing, so I wrote this 4-line Python fix

Overview

It happened again.

My script was perfect locally. I pushed it to CI/CD, and… 403 Forbidden. I wasn’t testing a bank; I was testing a landing page. The modern web has become hostile to automation.

Developers are tired of getting blocked by Cloudflare Turnstiles and “Verify you are human” loops when using Selenium or Playwright. We spend more time fighting bot detection than writing actual tests.

The Old Way (The Struggle)

We’ve all been there. You try to make Selenium “stealthy” by piling on options, changing user agents, and praying.

# The "Please don't ban me" starter pack
options = webdriver.ChromeOptions()
options.add_argument("--headless")  # 
  • PyPI:

Acknowledgements

This project wouldn’t exist without the incredible work done by the SeleniumBase team. sb‑stealth‑wrapper is essentially a love letter to their engineering on UC Mode. I simply wrapped their robust engine in a way that makes it “plug‑and‑play” for specific CI/CD use cases. If you like the wrapper, please give SeleniumBase a star on GitHub—they deserve all the credit for the heavy lifting.

Ethical Disclaimer: This tool is for educational purposes and for testing environments you own. Do not use it for unauthorized scraping or bypassing security controls on websites you do not have permission to test.

Back to Blog

Related posts

Read more »

What Happens When You Run Python Code?

Python is a popular programming language, but have you ever wondered what happens behind the scenes when you run a Python program on your computer? In this arti...