Skip to main content

playwright stealth

Project description

playwright_stealth

Transplanted from puppeteer-extra-plugin-stealth, Not perfect.

Install

$ pip install playwright-stealth

Usage

sync

from playwright.sync_api import sync_playwright
from playwright_stealth import stealth_sync

with sync_playwright() as p:
    for browser_type in [p.chromium, p.firefox, p.webkit]:
        browser = browser_type.launch()
        page = browser.new_page()
        stealth_sync(page)
        page.goto('http://whatsmyuseragent.org/')
        page.screenshot(path=f'example-{browser_type.name}.png')
        browser.close()

async

# -*- coding: utf-8 -*-
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import stealth_async

async def main():
    async with async_playwright() as p:
        for browser_type in [p.chromium, p.firefox, p.webkit]:
            browser = await browser_type.launch()
            page = await browser.new_page()
            await stealth_async(page)
            await page.goto('http://whatsmyuseragent.org/')
            await page.screenshot(path=f'example-{browser_type.name}.png')
            await browser.close()

asyncio.get_event_loop().run_until_complete(main())

Test results

playwright with stealth

playwright without stealth

playwright without stealth

playwright with stealth

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

playwright-stealth-1.0.6.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

playwright_stealth-1.0.6-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file playwright-stealth-1.0.6.tar.gz.

File metadata

  • Download URL: playwright-stealth-1.0.6.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for playwright-stealth-1.0.6.tar.gz
Algorithm Hash digest
SHA256 b504d951d00fac755c7d13665a29611d415180510bd7d23f14ebc89439ba2043
MD5 84e19efdfab01a2a2e064969ec2b36e5
BLAKE2b-256 e5dc4e88b517e4c9cfb63f1b0b67d59adddcef2dc2fe0883b90e07119d15895a

See more details on using hashes here.

File details

Details for the file playwright_stealth-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for playwright_stealth-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b1b2bcf58eb6859aa53d42c49b91c4e27b74a6d13fc3d0c85eea513dd55efda3
MD5 31cccb60e5b13da98ece296612a83de7
BLAKE2b-256 341060981cb8d8e22487061b98a0803313c4fb519cc95ab1421516304a0cfcd0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page