tf-playwright-stealth

1.2.0 · active · verified Sun Apr 12

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.

Warnings

Install

Imports

Quickstart

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()

view raw JSON →