{"id":3214,"library":"playwright-stealth","title":"Playwright Stealth","description":"Playwright Stealth is a Python package designed to make Playwright browser automation sessions less detectable by anti-bot systems. It achieves this by patching various browser fingerprints and automation-specific properties. Actively maintained, it currently stands at version 2.0.3 and utilizes a modern context-manager API for integration with Playwright.","status":"active","version":"2.0.3","language":"en","source_language":"en","source_url":"https://github.com/Mattwmaster58/playwright_stealth","tags":["playwright","stealth","scraping","automation","anti-bot","web scraping"],"install":[{"cmd":"pip install playwright-stealth","lang":"bash","label":"Install package"},{"cmd":"playwright install chromium","lang":"bash","label":"Install Playwright browser binaries (required)"}],"dependencies":[{"reason":"playwright-stealth patches the underlying Playwright browser instance, thus Playwright is a core dependency.","package":"playwright","optional":false}],"imports":[{"symbol":"Stealth","correct":"from playwright_stealth import Stealth"},{"note":"These functions were part of the v1.x API and are deprecated. The v2.x API uses a context manager approach.","wrong":"from playwright_stealth import stealth_async","symbol":"stealth_async / stealth_sync"}],"quickstart":{"code":"import asyncio\nimport os\nfrom playwright.async_api import async_playwright\nfrom playwright_stealth import Stealth\n\nasync def main():\n    async with Stealth().use_async(async_playwright()) as p:\n        browser = await p.chromium.launch(headless=True)\n        page = await browser.new_page()\n        \n        # Example: Go to a test page and check navigator.webdriver property\n        # An actual stealth check would involve visiting sannysoft.com or similar\n        await page.goto(\"https://www.google.com\")\n        is_webdriver = await page.evaluate(\"navigator.webdriver\")\n        print(f\"Is navigator.webdriver set? {is_webdriver}\")\n\n        # Navigate to another page\n        await page.goto(\"https://web-scraping.dev/products\")\n        title = await page.title()\n        print(f\"Page title: {title}\")\n        \n        await browser.close()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates the recommended asynchronous usage of `playwright-stealth` with Playwright's context manager. It launches a stealthy Chromium browser, checks the `navigator.webdriver` property (which should be `False` or undefined when stealth is applied), and navigates to a sample page. Remember to install Playwright browser binaries via `playwright install chromium` first."},"warnings":[{"fix":"Migrate your code to use the `Stealth` class with its context manager (`async with Stealth().use_async(async_playwright())`) or `apply_stealth_async(context)` method.","message":"The API for `playwright-stealth` underwent a breaking change from v1.x to v2.x. Older patterns like `stealth_async(page)` or `stealth_sync(page)` are no longer supported. The current recommended approach uses a `Stealth().use_async(async_playwright())` context manager or `stealth.apply_stealth_async(context)` method for explicit control.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"For highly protected websites, consider combining `playwright-stealth` with proxy rotation (especially residential proxies), realistic user behavior simulation (random delays, mouse movements), and session management.","message":"While `playwright-stealth` helps bypass many common bot detection methods by patching browser fingerprints (e.g., `navigator.webdriver`, User-Agent), it does not provide complete immunity against advanced anti-bot systems. These systems might analyze IP reputation, TLS fingerprints, behavioral patterns, and other infrastructure-level signals, which `playwright-stealth` does not address.","severity":"gotcha","affected_versions":"All versions"},{"fix":"After installing `playwright-stealth`, run `playwright install` (or `playwright install chromium` for a specific browser) in your environment to download the necessary browser binaries.","message":"The `playwright` library (on which `playwright-stealth` depends) no longer automatically downloads browser binaries (Chromium, Firefox, WebKit) when installed via `pip` since version 1.38+. If you forget to install the browsers, `playwright-stealth` will fail to launch a browser.","severity":"gotcha","affected_versions":"playwright>=1.38.0"},{"fix":"Implement robust infrastructure-level solutions for scaling, such as distributed proxies, diverse user-agent rotation, dynamic header management, and careful pacing of requests to mimic human browsing more closely.","message":"Stealth techniques that work for small-scale testing often fail when scaled up. Consistent browser fingerprints, repeated access patterns from the same IP, and rapid requests can lead to detection and blocking by anti-bot services, even with stealth plugins.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}