Registry / http-networking / tf-playwright-stealth

tf-playwright-stealth

JSON →
library1.2.0pypypi✓ verified 23d ago

tf-playwright-stealth is a Python package designed to make Playwright instances stealthy by spoofing browser features, thereby reducing the chance of detection by anti-bot systems. The current version is 1.2.0, and it has seen multiple releases since its first publication in March 2024, indicating active maintenance.

pip install tf-playwright-stealth
INSTALL
IMPORT
SIG · TF-PLAYWRIGHT-STEA
T
tf-playwright-stealth
http-networkingpythonv1.2.0
Install
3.4s avg
Import
482ms
Disk
156MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.482s · 158MB
156MB installed
● package 156MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stealth_sync
from playwright_stealth import stealth_sync
stealth_async
from playwright_stealth import stealth_async
Stealth
from playwright_stealth import Stealth
The 'Stealth' class (with a capital 'S') belongs to the separate 'playwright-stealth' package, not 'tf-playwright-stealth'. This package exports 'stealth_sync' and 'stealth_async' (lowercase 's') functions.

This quickstart demonstrates how to apply stealth features to a synchronous Playwright page. It launches a headless Chromium browser, applies the `stealth_sync` function to the page, and then navigates to a bot detection test site (sannysoft.com) to verify its effectiveness.

from playwright.sync_api import sync_playwright from playwright_stealth import stealth_sync with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page() stealth_sync(page) page.goto("https://bot.sannysoft.com/") print(f"Page title: {page.title()}") page.screenshot(path="example_with_stealth.png", full_page=True) browser.close()
Debug
Known issues
gotchaThere are two similarly named, but distinct, Python packages: `tf-playwright-stealth` (this library) and `playwright-stealth`. They have different APIs. `tf-playwright-stealth` provides `stealth_sync` and `stealth_async` functions, while `playwright-stealth` offers a `Stealth` class. Attempting to import `Stealth` from `playwright_stealth` when `tf-playwright-stealth` is installed will result in an `ImportError`. Ensure you use the correct imports for the installed package.
fix
Use `from playwright_stealth import stealth_sync` or `from playwright_stealth import stealth_async` instead of `from playwright_stealth import Stealth` when using `tf-playwright-stealth`.
affects: All versions
gotchaStealth plugins like `tf-playwright-stealth` primarily address browser fingerprinting (e.g., `navigator.webdriver`, plugins, user-agent consistency). They do not inherently prevent detection based on IP reputation, TLS fingerprinting (JA3/JA4), behavioral analysis, or advanced JavaScript challenges employed by sophisticated anti-bot systems (like Cloudflare Turnstile, DataDome, Kasada).
fix
For more robust evasion against advanced detection, consider combining stealth techniques with residential proxies, careful pacing, human-like interaction simulation, and potentially specialized managed browser infrastructure or CAPTCHA-solving services.
affects: All versions
gotchaOlder versions (prior to 1.x, or specific bugfix releases) of `playwright_stealth` (the internal module name) may have suffered from a missing `__init__.py` file, leading to `ImportError` issues. While likely resolved in current versions, users experiencing import problems should verify the package structure or update to the latest release.
fix
Upgrade to the latest version of `tf-playwright-stealth` (`pip install --upgrade tf-playwright-stealth`) and ensure a clean Python environment.
affects: <1.0.0 (and potentially early 1.x versions)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tf-playwright-stealth'
Python import statements replace hyphens (-) in package names with underscores (_).
fix
Use underscores in the import statement: `import tf_playwright_stealth` or `from tf_playwright_stealth import stealth_sync`
AttributeError: 'Page' object has no attribute 'stealth'
The `tf-playwright-stealth` library provides `stealth_sync` and `stealth_async` functions that modify an existing `Page` object, rather than adding a 'stealth' method directly to the `Page` object.
fix
Call the appropriate stealth function after creating the `Page` object: `from tf_playwright_stealth import stealth_sync; stealth_sync(page)`
TypeError: 'page' argument must be a playwright.sync_api.Page object, not <class 'playwright.async_api._generated.Page'>
The user is attempting to pass an asynchronous Playwright `Page` object to the synchronous `stealth_sync` function, or vice-versa with `stealth_async`.
fix
Ensure that `stealth_sync` is used with a `playwright.sync_api.Page` object and `stealth_async` with a `playwright.async_api.Page` object.
ERROR: Could not find a version that satisfies the requirement tf-playwright-stealth
Pip was unable to locate the package on PyPI, often due to a typo in the package name, network connectivity issues, or a misconfigured PyPI index.
fix
Verify the package name is spelled correctly as `tf-playwright-stealth`, ensure an active internet connection, and try `pip install tf-playwright-stealth`.
Upgrade
Version history
1.2.0latest on PyPI · released Jun 13, 2025
Audit
Dependencies
playwrightrequiredCore browser automation library, required for functionality.
Agent activity
46 hits · last 30 days
node
42
Amazon
1
OpenAI (training)
1
Resources
tf-playwright-stealth — pip install tf-playwright-stealth · libregistry