Skip to content

tinyfish-io/tf-playwright-stealth

Folders and files

NameName
Last commit message
Last commit date
Apr 21, 2025
Nov 16, 2024
Nov 16, 2024
Oct 22, 2024
Feb 22, 2025
Feb 22, 2025
Dec 22, 2020
Oct 22, 2024
Oct 22, 2024
Mar 4, 2025
Feb 22, 2025
Dec 22, 2020
Sep 8, 2023
Nov 19, 2024
Oct 22, 2024
Dec 12, 2024
Feb 22, 2025

Repository files navigation

🥷🏻 tf-playwright-stealth PyPI version AgentQL Join Discord

Transplanted from puppeteer-extra-plugin-stealth.

This is a package that makes playwright stealthy like a ninja by spoofing browser features in order to reduce the chance of detection.

Install

pip install tf-playwright-stealth

Usage

sync

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/")
    page.screenshot(path=f"example_with_stealth.png", full_page=True)
    browser.close()

async

from playwright.async_api import async_playwright
from playwright_stealth import stealth_async

with async_playwright() as p:
    browser = await p.chromium.launch(
            headless=True,
        )
    page = await browser.new_page()
    await stealth_async(page)
    await page.goto("https://bot.sannysoft.com/")
    await page.screenshot(path=f"example_with_stealth_async.png", full_page=True)
    await browser.close()

Results

From bot.sannysoft.com

Headless Headful
Headless Headful