Skip to main content
Get up and running with Undetected ChromeDriver in just a few simple steps.

Prerequisites

Before you begin, ensure you have:
  • Python 3.10 or higher installed
  • Chrome or a Chromium-based browser installed
  • pip package manager

Installation

1

Install the package

Install Undetected using pip:
pip install undetected
This will also install the required dependencies: selenium, requests, websockets, and packaging.
2

Create your first script

Create a new Python file called test_undetected.py:
import undetected as uc

# Create an undetected Chrome instance
driver = uc.Chrome()

# Navigate to a website
driver.get("https://example.com")

# Print the page title
print(driver.title)

# Close the browser
driver.quit()
3

Run the script

Execute your script:
python test_undetected.py
On first run, Undetected will automatically download and patch the ChromeDriver binary matching your Chrome version. This may take a moment. The binary is cached for subsequent runs.

Test Bot Detection Bypass

Let’s verify that Undetected successfully bypasses bot detection:
import undetected as uc

driver = uc.Chrome()

# Visit a bot detection test site
driver.get("https://bot.sannysoft.com")

# The page should show you as undetected
# (green checkmarks instead of red warning signs)

input("Press Enter to close the browser...")
driver.quit()
If the test site shows green checkmarks for most tests, your setup is working correctly. Some advanced detection methods may still identify automation, but common systems like CloudFlare should be bypassed.

Common Usage Patterns

Headless Mode

Run Chrome without a visible window:
import undetected as uc

driver = uc.Chrome(headless=True)
driver.get("https://example.com")
print(driver.title)
driver.quit()
Headless mode is less undetectable than regular mode. Some websites can still detect headless browsers through various techniques.

Custom Options

Customize browser behavior using ChromeOptions:
import undetected as uc

options = uc.ChromeOptions()
options.add_argument('--start-maximized')
options.add_argument('--disable-notifications')

driver = uc.Chrome(options=options)
driver.get("https://example.com")
driver.quit()

Using Context Manager

Automatically clean up resources:
import undetected as uc

with uc.Chrome() as driver:
    driver.get("https://example.com")
    print(driver.title)
    # Browser automatically closes when exiting the context

Multiprocessing

For running multiple browser instances in parallel:
import undetected as uc
from undetected.patcher import Patcher
import multiprocessing as mp

def worker(idx: int):
    driver = uc.Chrome(user_multi_procs=True)
    driver.get("https://example.com")
    print(f"Worker {idx}: {driver.title}")
    driver.quit()

if __name__ == "__main__":
    # Pre-patch ChromeDriver once before spawning processes
    Patcher.patch()
    
    # Create and start worker processes
    processes = [mp.Process(target=worker, args=(i,)) for i in range(4)]
    for p in processes:
        p.start()
    for p in processes:
        p.join()
When using multiprocessing, always call Patcher.patch() once in the main process before creating workers, and use user_multi_procs=True in worker processes.

Next Steps

Core Concepts

Learn about the Chrome class and its parameters

Advanced Features

Explore CDP events, headless mode, and more

Guides

Follow practical guides for common use cases

API Reference

Complete API documentation for all classes

Best Practices

Always call driver.quit() or use a context manager to ensure the browser and ChromeDriver processes are properly terminated.
Undetected works best with default settings. Customizing ChromeOptions can introduce detectable fingerprints.
The first run will download and patch ChromeDriver, which may take 10-30 seconds. Plan for this in your automation scripts.
Add random delays between actions to mimic human behavior:
import time
import random

time.sleep(random.uniform(1, 3))  # Random delay between 1-3 seconds

Troubleshooting

If you encounter issues, check the Troubleshooting Guide for common problems and solutions.

Build docs developers (and LLMs) love