Undetected ChromeDriver is a Python library that serves as a `selenium.webdriver.Chrome` replacement, optimized to bypass anti-bot detection systems like Cloudflare, Imperva, and DataDome. It automatically downloads and patches the appropriate ChromeDriver binary for the installed Chrome version. The library is actively maintained, with version 3.5.5 being the latest stable release, and it offers ongoing efforts to understand and counter detection algorithms.
pip install undetected-chromedriverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `undetected-chromedriver`, navigate to a website that performs bot detection, and verify successful access by printing the page title and saving a screenshot. It includes best practices for resource cleanup and stability.
Review release notes for versions 3.4.0 and 3.5.0 on GitHub for necessary code adjustments. Avoid using removed constructor arguments.
Run Chrome in non-headless mode if possible for better anti-detection results. If headless is essential, be prepared for increased detection rates and consider additional stealth techniques.
Integrate a robust proxy solution (e.g., rotating proxies) with `undetected-chromedriver` to mask your IP address, especially when operating from data centers or at scale.
Ensure your local Chrome browser is up-to-date. If issues persist, try initializing `uc.Chrome(version_main=YOUR_CHROME_MAJOR_VERSION)` to force a specific ChromeDriver version, or `uc.Chrome(use_subprocess=True)` for better auto-handling.
Use `ChromeOptions` sparingly. Only add arguments or preferences if absolutely necessary, and be aware that they might increase detectability. Test thoroughly with and without custom options.
Account for this initial delay in your automation scripts, especially for time-sensitive operations. Subsequent runs will be faster due to caching.