{"id":4404,"library":"undetected-chromedriver","title":"Undetected ChromeDriver","description":"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.","status":"active","version":"3.5.5","language":"en","source_language":"en","source_url":"https://github.com/ultrafunkamsterdam/undetected-chromedriver","tags":["selenium","webdriver","chrome","anti-bot","scraping","automation","headless"],"install":[{"cmd":"pip install undetected-chromedriver","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Required Python version. While >=3.6 is supported, 3.10+ is recommended by some documentation.","package":"python","optional":false},{"reason":"Core WebDriver functionality. Automatically installed.","package":"selenium","optional":false},{"reason":"HTTP library for downloading ChromeDriver. Automatically installed.","package":"requests","optional":false},{"reason":"WebSocket support for CDP communication. Automatically installed.","package":"websockets","optional":false},{"reason":"Version parsing utilities. Automatically installed.","package":"packaging","optional":false}],"imports":[{"note":"`undetected_chromedriver.v2` was an older beta import path and has since been aliased or removed. The direct import `import undetected_chromedriver as uc` is the current and recommended approach.","wrong":"import undetected_chromedriver.v2 as uc","symbol":"Chrome","correct":"import undetected_chromedriver as uc\ndriver = uc.Chrome()"}],"quickstart":{"code":"import undetected_chromedriver as uc\nimport time\nimport os\n\n# Create an undetected Chrome instance\n# use_subprocess=True is often recommended for stability\n# and to avoid issues with ChromeDriver matching.\ndriver = uc.Chrome(use_subprocess=True)\n\ntry:\n    # Navigate to a website known for bot detection checks\n    driver.get(\"https://nowsecure.nl\")\n\n    # Give it some time to load and for anti-bot measures to potentially resolve\n    time.sleep(5)\n\n    # Print the page title to verify\n    print(f\"Page title: {driver.title}\")\n\n    # Optionally take a screenshot\n    screenshot_path = \"nowsecure_screenshot.png\"\n    driver.save_screenshot(screenshot_path)\n    print(f\"Screenshot saved to {screenshot_path}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\nfinally:\n    # Always ensure the driver is quit to clean up resources\n    driver.quit()\n    print(\"Browser closed.\")","lang":"python","description":"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."},"warnings":[{"fix":"Review release notes for versions 3.4.0 and 3.5.0 on GitHub for necessary code adjustments. Avoid using removed constructor arguments.","message":"Version 3.4.0 introduced significant changes to the anti-detection mechanism and file naming, potentially breaking existing code. Version 3.5.0 further removed `service_args`, `service_creationflags`, and `service_log_path` from the constructor. Users upgrading from older versions (especially pre-3.4.0) should review their code and migration guides.","severity":"breaking","affected_versions":">=3.4.0"},{"fix":"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.","message":"While technically possible (`headless=True`), headless mode is officially unsupported and generally less undetectable than running Chrome with a visible UI. Websites can employ various techniques to detect headless browsers, increasing the likelihood of being blocked.","severity":"gotcha","affected_versions":"All"},{"fix":"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.","message":"This library *does not* hide your IP address. Running scripts from data centers or with low IP reputation will still likely result in detection and blocking, regardless of `undetected-chromedriver`.","severity":"gotcha","affected_versions":"All"},{"fix":"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.","message":"A common issue arises when Chrome auto-updates, leading to a version mismatch with the `chromedriver` binary downloaded by the library. This can cause `WebDriverException` errors (e.g., 'This version of ChromeDriver only supports Chrome version X, Current browser version is Y').","severity":"gotcha","affected_versions":"All"},{"fix":"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.","message":"While `ChromeOptions` allow customization, sticking to default settings is generally recommended. Overly customizing options can introduce unique browser fingerprints that anti-bot systems might detect, reducing the effectiveness of `undetected-chromedriver`.","severity":"gotcha","affected_versions":"All"},{"fix":"Account for this initial delay in your automation scripts, especially for time-sensitive operations. Subsequent runs will be faster due to caching.","message":"The initial run of `undetected-chromedriver` will automatically download and patch the necessary `chromedriver` binary. This process can take 10-30 seconds, leading to a delayed startup for the first session.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}