Mastering Undetected-Chromedriver: A Comprehensive Guide for Web Scraping
Have you ever spent countless hours developing the perfect web scraping script with Selenium, only to be met with the frustrating roadblocks of Cloudflare’s 5-second challenge, Imperva’s “Access Denied” page, or Datadome’s bot detection warnings? If so, you’re not alone. The standard Selenium Chromedriver often leaves behind easily detectable “bot footprints,” such as the navigator.webdriver flag, non-human user-agent strings, and unusual browser configurations. These footprints make it easy for anti-bot systems to identify and block automated browsers.
This is where undetected-chromedriver comes into play. It’s an optimized and patched version of Selenium’s Chromedriver designed to minimize these tell-tale signs, allowing your automated browser to behave more like a genuine human user. However, even with undetected-chromedriver, making frequent requests from a single IP address can still lead to blocking. This is why a reliable proxy service is absolutely essential. Among the many proxy solutions available, IPFLY distinguishes itself with its no-client design, seamless integration with undetected-chromedriver, and an impressive 99.9% uptime, ensuring your scraping tasks run smoothly and efficiently.
In this comprehensive guide, we will cover everything from the basics of undetected-chromedriver (including installation and basic usage) to its underlying working principles, advanced anti-detection configurations, and a step-by-step integration with IPFLY proxy. Whether you’re a beginner just starting out or an experienced developer struggling with persistent blocking issues, this guide provides the knowledge and tools you need to succeed.

Understanding Undetected-Chromedriver & How It Bypasses Anti-Bot Systems
Before we delve into the practical aspects, it’s important to understand what makes undetected-chromedriver different from the standard Chromedriver. Simply put, undetected-chromedriver is a Python library that patches the standard Chromedriver to eliminate the “leaks” or “footprints” that anti-bot systems use to identify automated browsers.
Core Working Principles
Undetected-chromedriver bypasses anti-bot systems through several key techniques:
- Variable Renaming: It renames Selenium-specific variables to match those used by genuine browsers, preventing detection based on unique variable signatures.
- Genuine User-Agent Strings: It uses real-world user-agent strings instead of generic ones, making the browser appear more authentic and less like an automated bot.
- Disabling Automation Flags: It patches the
navigator.webdriverproperty (a common detection point) to returnundefinedinstead oftrue, effectively hiding the fact that the browser is being controlled by Selenium. - Natural Session Management: It properly handles cookies, local storage, and session states, simulating the way real users browse the internet, which helps to avoid being flagged as a bot.
- Proxy Compatibility: It natively supports proxy configurations, allowing users to rotate IP addresses to avoid IP-based blocking, a crucial aspect of successful web scraping.
Key Advantages Over Standard Chromedriver
Compared to the standard Selenium Chromedriver, undetected-chromedriver offers three major advantages for web scraping:
- Higher Anti-Detection Success Rate: It can bypass most mainstream anti-bot systems, including Cloudflare, Imperva, and Datadome, significantly reducing the chances of being blocked.
- Automatic Driver Management: It automatically downloads and patches the correct Chromedriver version matching your Chrome browser, eliminating the manual and often frustrating task of version matching.
- Flexible Configuration: It supports all standard ChromeOptions while adding extra anti-detection parameters for more granular control, allowing you to fine-tune your scraping setup for optimal performance.
Step-by-Step: Getting Started with Undetected-Chromedriver
Let’s walk through the core steps of using undetected-chromedriver, from setting up your environment to performing basic scraping. We’ll be using Python (3.6+) as the development language, which is the most widely used language for working with undetected-chromedriver.
Prerequisites
- Python 3.6 or higher: Check your Python version with
python --version(orpython3 --versionon macOS/Linux). - Latest Chrome Browser: Undetected-chromedriver relies on Chrome, so ensure you have the latest stable version installed. Keeping Chrome updated is crucial for compatibility and security.
- Virtual Environment (Recommended): Avoid dependency conflicts with other projects. Use Python’s built-in
venvor third-party tools likeuvto create isolated environments for your scraping projects.
Installing Undetected-Chromedriver
Install the library via pip with a single command:
# Install the latest version
pip install undetected-chromedriver
# If you encounter compatibility issues, install a specific stable version (e.g., 3.5.5)
pip install undetected-chromedriver==3.5.5
Troubleshooting Tip: If you see ModuleNotFoundError: No module named 'undetected_chromedriver', ensure pip is installed in the same Python environment you’re using, or use pip3 instead of pip. This is a common issue that can be easily resolved by verifying your environment.
Basic Usage: Your First Anti-Detection Scraping Script
Let’s write a simple script to scrape a page protected by anti-bot measures (e.g., nowsecure.nl, a common test site for anti-detection tools). This script will verify that undetected-chromedriver can bypass basic blocking:
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
import time
# Configure Chrome options
options = uc.ChromeOptions()
# Optional: Enable headless mode (note: some sites detect headless, use cautiously)
# options.add_argument("--headless=new")
# Disable audio to reduce footprints
options.add_argument("--mute-audio")
# Add a genuine user-agent (replace with a real one from your browser)
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")
# Create the undetected-chromedriver instance
driver = uc.Chrome(options=options)
try:
# Navigate to the test site
driver.get("https://nowsecure.nl")
# Wait for the page to load (simulate human behavior)
time.sleep(3)
# Scrape the page title
page_title = driver.title
print(f"Page Title: {page_title}")
# Save a screenshot to verify access
driver.save_screenshot("nowsecure_access.png")
print("Scraping successful! Screenshot saved as 'nowsecure_access.png'")
finally:
# Close the browser
driver.quit()
Run the script. If it prints the page title and saves the screenshot without errors, congratulations—you’ve successfully bypassed the anti-bot measures with undetected-chromedriver!
Advanced Configuration: Enhance Anti-Detection Capabilities
For more strict anti-bot systems (e.g., Amazon, eBay), you need additional configurations to mimic human behavior even more closely. Here are key advanced settings:
import undetected_chromedriver as uc
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import time
import random
def create_stealth_driver():
options = uc.ChromeOptions()
# Core anti-detection options
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
# Disable extensions to avoid footprints
options.add_argument("--disable-extensions")
# Use a custom user data directory to simulate a regular user profile
options.add_argument("--user-data-dir=C:/Temp/ChromeUserData") # Windows example
# Randomize window size (real users don't use fixed sizes)
window_sizes = [(1920, 1080), (1366, 768), (1536, 864)]
width, height = random.choice(window_sizes)
options.add_argument(f"--window-size={width},{height}")
# Create driver
driver = uc.Chrome(options=options)
# Further hide automation traces with JavaScript
driver.execute_script("""
Object.defineProperty(navigator, 'webdriver', {get: () => undefined});
Object.defineProperty(navigator, 'plugins', {get: () => [1, 2, 3]});
Object.defineProperty(navigator, 'languages', {get: () => ['en-US', 'en']});
""")
# Simulate random mouse movement (mimic human behavior)
ActionChains(driver).move_by_offset(random.randint(10, 50), random.randint(10, 50)).perform()
return driver
# Usage
driver = create_stealth_driver()
try:
driver.get("https://www.amazon.com")
time.sleep(random.uniform(2, 5)) # Random delay
# Simulate search (human-like typing speed)
search_box = driver.find_element(By.ID, "twotabsearchtextbox")
for char in "wireless headphones":
search_box.send_keys(char)
time.sleep(random.uniform(0.1, 0.3))
search_box.send_keys(Keys.ENTER)
time.sleep(random.uniform(3, 6))
print("Advanced scraping setup successful!")
finally:
driver.quit()
The Critical Importance of Proxy Integration for Long-Term Scraping
Even with the most advanced anti-detection configurations, undetected-chromedriver cannot solve IP-based blocking. If you send dozens of requests from the same IP address, the target site will still flag you as a bot and block your access. This is where a high-quality proxy service becomes absolutely essential for any serious web scraping project. Proxies allow you to rotate your IP address, making it appear as though requests are coming from multiple users, thus reducing the risk of being blocked.
Why Proxies Fail with Undetected-Chromedriver (Common Pitfalls)
Many developers struggle with proxy integration due to these common issues:
- Proxy Client Bloat: Some proxy services, like Bright Data, require installing a Proxy Manager client, which adds extra layers of complexity and may introduce new detection footprints.
- Authentication Issues: Basic proxies often trigger Chrome’s authentication pop-ups, which can disrupt automated workflows and lead to scraping failures.
- Low Uptime: Unreliable proxies can drop connections mid-scraping, leading to incomplete data collection and wasted resources.
- Protocol Incompatibility: Some proxies may not work seamlessly with undetected-chromedriver’s patched Chrome instance, causing session crashes and other unexpected errors.
IPFLY: The No-Client Proxy Solution for Undetected-Chromedriver
IPFLY addresses these problems with its lightweight, no-client design, making it the perfect partner for undetected-chromedriver. Here’s why IPFLY is an ideal choice:
- No Client Installation: Configure directly via code or ChromeOptions, eliminating the need for extra software. This keeps your scraping environment clean and reduces the risk of introducing new detection points.
- 99.9% Uptime: IPFLY’s global residential IP network with BGP multi-line redundancy ensures stable connections, which is crucial for long-running scraping tasks where reliability is paramount.
- Seamless Authentication: Embed username/password directly in the proxy URL to avoid annoying pop-ups, ensuring full compatibility with undetected-chromedriver and a smoother scraping experience.
- Multi-Protocol Support: Supports SOCKS5, HTTP, and HTTPS protocols, giving you the flexibility to choose the best protocol based on the target site’s requirements.
- Cost-Effective: Pay-as-you-go pricing starts at $0.8/GB, a fraction of the cost of competitors like Oxylabs, making it a budget-friendly option for both small and large scraping projects.
Step-by-Step: Integrating IPFLY with Undetected-Chromedriver
Follow these steps to configure IPFLY proxy in your undetected-chromedriver workflow:
Step 1: Obtain Your IPFLY Proxy Details
Log into your IPFLY account, generate a residential proxy, and obtain the proxy URL in the format: socks5://username:password@proxy-ip:port (SOCKS5 is generally recommended for better anti-detection performance).
Step 2: Integrate IPFLY Proxy into Undetected-Chromedriver
Use ChromeOptions to add the proxy configuration. Here’s a complete example combining advanced anti-detection settings and IPFLY proxy:
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
import time
import random
# IPFLY proxy configuration (replace with your actual proxy details)
IPFLY_PROXY = "socks5://username:password@proxy-ip:port"
def create_stealth_driver_with_proxy():
options = uc.ChromeOptions()
# Core anti-detection options
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--mute-audio")
# Add genuine user-agent
options.add_argument("user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")
# Configure IPFLY proxy
options.add_argument(f'--proxy-server={IPFLY_PROXY}')
# Create driver
driver = uc.Chrome(options=options)
# Hide automation traces
driver.execute_script("""
Object.defineProperty(navigator, 'webdriver', {get: () => undefined});
Object.defineProperty(navigator, 'languages', {get: () => ['en-US', 'en']});
""")
return driver
# Test the proxy + anti-detection setup
driver = create_stealth_driver_with_proxy()
try:
# Navigate to a site to check IP
driver.get("https://api.ipify.org")
time.sleep(2)
proxy_ip = driver.find_element(By.TAG_NAME, "body").text
print(f"Current Proxy IP: {proxy_ip}")
# Navigate to a protected site (e.g., Amazon)
driver.get("https://www.amazon.com")
time.sleep(random.uniform(3, 5))
print("Successfully accessed Amazon with IPFLY proxy!")
finally:
driver.quit()
Step 3: Verify Proxy Effectiveness
Run the script. The printed IP address should match your IPFLY proxy IP, confirming the integration is successful. If you can access Amazon or other protected sites without being blocked, your setup is working correctly and you’re ready to start scraping!
Proxy Service Comparison: IPFLY vs. Competitors for Undetected-Chromedriver
To help you understand why IPFLY is the best fit for undetected-chromedriver, let’s compare it with mainstream proxy services Bright Data and Oxylabs across key metrics:
| Feature | IPFLY | Bright Data | Oxylabs |
|---|---|---|---|
| Client Installation Requirement | No – direct configuration via code/ChromeOptions | Yes – requires Proxy Manager client | Yes – needs API client deployment |
| Uptime Guarantee | 99.9% (SLA-backed, stable for long scraping tasks) | 99.7% (basic plan); 99.9% (premium only) | 99.8% (enterprise plan only) |
| Starting Pricing | $0.8/GB (pay-as-you-go, no hidden fees) | $2.94/GB (pay-as-you-go, premium features add cost) | $8/GB (pay-as-you-go, enterprise-focused) |
| Integration Difficulty | Simple – 5-minute setup, compatible with all undetected-chromedriver versions | Medium – requires client configuration + API key setup | Complex – enterprise-grade settings, steep learning curve |
| Authentication Method | URL-embedded credentials (no pop-ups) | API key + client authentication (prone to session errors) | Enterprise SSO/API key (overkill for individual developers) |
Key Takeaway: For undetected-chromedriver users, IPFLY’s no-client design, high uptime, and affordability make it the most practical choice. Competitors force you to deal with unnecessary client installations and high costs, while IPFLY keeps your workflow lightweight and efficient.
Whether you’re looking for reliable proxy services or want to master the latest proxy operation strategies, IPFLY has you covered! Visit IPFLY.net and join the IPFLY Telegram community for first-hand information and professional support. Let proxies become a boost for your business, not a problem!

Troubleshooting Common Undetected-Chromedriver Issues
Even with the right setup, you may encounter issues. Here are solutions to the most frequent problems:
“Session Not Created” Error
Cause: Mismatch between undetected-chromedriver version and Chrome browser version.
Solution: Update undetected-chromedriver to the latest version, or install a version compatible with your Chrome. Check the Chrome version (Settings > About Chrome) and install the corresponding undetected-chromedriver version.
# Install a specific version compatible with Chrome 120+
pip install undetected-chromedriver==3.5.5
Still Being Detected by Cloudflare/Datadome
Cause: Missing advanced anti-detection configurations or static IP address.
Solution: Add the advanced settings (disable AutomationControlled, randomize window size, simulate human interactions) and use IPFLY’s rotating residential proxies to change IP addresses regularly. Ensure that you are rotating your IP address frequently to avoid detection.
Proxy Authentication Pop-Ups
Cause: Incorrect proxy authentication method.
Solution: Use IPFLY’s URL-embedded credentials (e.g., socks5://username:password@ip:port) instead of basic proxy settings. This avoids Chrome’s authentication pop-ups and simplifies the authentication process.
Headless Mode Detection
Cause: Some sites detect headless mode via JavaScript.
Solution: Avoid headless mode for strict anti-bot sites. If you must use it, use the new headless mode (--headless=new) and add extra configurations to mimic a real browser:
options.add_argument("--headless=new")
options.add_argument("--window-size=1920,1080")
options.add_argument("--disable-gpu")
Mastering Anti-Detection Scraping with Undetected-Chromedriver + IPFLY
Undetected-chromedriver eliminates the “bot footprints” that plague traditional Selenium, making it a must-have tool for web scraping. But to unlock its full potential and avoid IP-based blocking, you need a reliable proxy service. IPFLY’s no-client design, 99.9% uptime, and seamless integration with undetected-chromedriver make it the perfect partner, keeping your scraping workflow lightweight, stable, and cost-effective.
By following the steps in this guide, you can build a robust anti-detection scraping system that bypasses most anti-bot measures. Whether you’re scraping e-commerce data, market research, or content aggregation, this combination will help you collect data efficiently without constant blocking headaches.
Now it’s time to put these techniques into practice. Grab your IPFLY proxy, fire up undetected-chromedriver, and take your web scraping to the next level!