---
title: "Playwright Stealth in Python: Install, Setup, and Proxies"
description: "A working playwright-stealth setup in Python: installation, configuration, fingerprint testing, and proxy integration, with code for each step."
url: "https://iproyal.com/blog/playwright-stealth/"
---

- [EN - English](https://iproyal.com/)
   
  [中文 - Chinese](https://iproyal.cn/)

[Book a Demo](https://iproyal.com/request-a-demo/) [Create Account](https://dashboard.iproyal.com/register/) [Create Account](https://dashboard.iproyal.com/register/) [Login](https://dashboard.iproyal.com/login/) [Login](https://dashboard.iproyal.com/login/)

[Book a Demo](https://iproyal.com/request-a-demo/)

[Back to blog](https://iproyal.com/blog/)

# Playwright Stealth in Python: Install, Setup, and Proxies

[Eugenijus Denisov](https://iproyal.com/blog/authors/eugenijus-denisov/)

[Last updated - November 26, 2026 ‐ 7 min read](https://iproyal.com/blog/authors/eugenijus-denisov/)

[Tutorials](https://iproyal.com/blog/category/tutorials/)

## Key Takeaways

- Playwright Stealth patches static fingerprints but cannot mimic human interactions.

- Applying the patches to one browser context leaves your other contexts unpatched, so you can compare both side by side.

- Matching your browser timezone and language to your proxy IP keeps the signals a site sees consistent.

Your Playwright web scraping script works on your laptop, then starts returning blocks or challenge screens once it runs headless on a server. Usually, bot detection mechanisms have picked up the default fingerprint of an automated browser, the server’s datacenter IP, or both.

This guide covers how to configure the Playwright Stealth plugin, verify the setup against bot detectors, build your Playwright scripts, and route traffic through a proxy whose location matches your browser environment.

## What Is Playwright Stealth?

Playwright Stealth is a Python plugin for the Playwright [browser automation framework ](https://iproyal.com/blog/puppeteer-vs-playwright-vs-selenium/)that patches the properties that give away a headless browser, such as *navigator.webdriver* and the HeadlessChrome user agent, so they match a regular Chrome installation.

Playwright has no built-in option to patch these properties, so the community maintains playwright-stealth as a separate package on [PyPI ](https://pypi.org/project/playwright-stealth/).

Its author calls it “a proof-of-concept starting point” and warns not to expect it to handle more than the simplest bot detection methods. In practice, it’s built for Chromium: its launch-flag and user agent patches only run there, and its JavaScript patches imitate Chrome.

## How to Install and Use playwright-stealth

### Installation

Install the Python package and its required browser binaries using two console commands:

```javascript
pip install playwright-stealth
playwright install chromium
```

This installs version 2.0.3 (released April 4, 2026), which is MIT-licensed and needs Python 3.9 or newer.

### The Recommended Setup

The standard method uses a context manager to apply the Playwright Stealth plugin globally to your entire Playwright instance. Every page and browser context created from that Playwright instance inherits the same patches, which the docs' example checks with *navigator.webdriver:*

```python
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import Stealth

async def main():
    # Every page created in this block gets the patches
    async with Stealth().use_async(async_playwright()) as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        print("from new_page:", await page.evaluate("navigator.webdriver"))

        # A separately created context gets the same patches
        different_context = await browser.new_context()
        page_from_context = await different_context.new_page()
        print("from new_context:", await page_from_context.evaluate("navigator.webdriver"))

        await browser.close()

asyncio.run(main())
```

### Applying Playwright Stealth to One Context

If you want granular control over browser automation, you can selectively apply the plugin to a single browser context and leave your other sessions untouched:

```python
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import Stealth

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        context = await browser.new_context()

        # apply the patches to just this context
        stealth = Stealth(init_scripts_only=True)
        await stealth.apply_stealth_async(context)
        page = await context.new_page()

asyncio.run(main())
```

Passing the *init\_scripts\_only=True* parameter limits the module to page init scripts, which run before any of the page's own code, detection scripts included, and stops it from adding Chromium launch flags such as *--disable-blink-features=AutomationControlled.* Here, the context already exists, so only the init scripts run either way.

### Turning Patches On and Off

To turn off a single patch, pass its flag to *Stealth(),* for example *navigator\_plugins=False.* To start from zero, import the *ALL\_EVASIONS\_DISABLED\_KWARGS* dictionary, unpack it into *Stealth(),* and switch single patches back on, which helps you isolate variables during testing.

To see what's active, inspect the *script\_payload* property, which holds the combined JavaScript of every enabled patch. It's an empty string when all of them are off, and the docs' *len()* check counts characters, not patches.

## Testing Whether Playwright Stealth Actually Works

You can test the patches by visiting the fingerprinting tool at *bot.sannysoft.com* to see the subtle traces browser automation leaves behind.

| **Standard headless mode** | **Patched with Playwright Stealth** |
| - | - |
| Fails navigator.webdriver check | Passes navigator.webdriver check |
| Returns empty plugins array | Reports valid Chrome plugins |
| Chrome characteristics missing | Passes the window\.chrome check |

In standard headless mode, the page flags the user agent, which contains “HeadlessChrome”, along with *navigator.webdriver* set to true and an empty plugins array. Changing the user agent header alone fixes only the first of these.

When you apply the Playwright Stealth plugin, these tests pass and the page reports a normal Chrome installation, which shows the Python package patches the most common [browser fingerprinting ](https://iproyal.com/blog/how-browser-fingerprints-are-detected/)signals.

## Scraping a Page With Playwright Stealth

A standard [web scraping ](https://iproyal.com/blog/internet-scraping-tools/)script navigates to a target URL, [waits for specific elements to load ](https://iproyal.com/blog/playwright-wait-for-page-to-load/), and extracts the data.

```python
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import Stealth

async def extract_book_titles():
    async with Stealth().use_async(async_playwright()) as p:
        browser = await p.chromium.launch(headless=True)
        page = await browser.new_page()

        await page.goto("https://books.toscrape.com/")
        await page.wait_for_selector("article.product_pod")

        titles = await page.locator("article.product_pod h3 a").evaluate_all("links => links.map(a => a.title)")

        for title in titles[:5]:
            print(f"Extracted: {title}")

        await browser.close()

asyncio.run(extract_book_titles())
```

The script waits for the book grid to appear in the DOM and then uses [Playwright ](https://iproyal.com/blog/playwright-web-scraping/)locators to pull each link's full title attribute into a Python list before calling the *await browser.close()* method.

## How to Use a Proxy With playwright-stealth

Many protected websites [block datacenter IPs ](https://iproyal.com/blog/how-to-bypass-ip-bans/)more readily than residential ones, and they read your location from your IP. With [residential proxies ](https://iproyal.com/residential-proxies/)pinned to one country, that location can match the timezone and language settings your browser reports.

Pass your proxy credentials or proxy rotation endpoint to *launch()* to route the whole patched browser through your new IP, or to *new\_context()* to give a single browser context its own proxy.

```python
import asyncio
from playwright.async_api import async_playwright
from playwright_stealth import Stealth

PROXY = {
    "server": "http://geo.iproyal.com:12321",
    "username": "your-username",
    "password": "your-password_country-gb",
}

# Match the patched navigator values to the exit country and your OS
stealth = Stealth(
    navigator_languages_override=("en-GB", "en"),
    navigator_platform_override="Win32",  # "MacIntel" on macOS, "Linux x86_64" on Linux
)

async def scrape_with_proxy():
    async with stealth.use_async(async_playwright()) as p:
        browser = await p.chromium.launch(proxy=PROXY)
        # Per-context alternative: launch() without a proxy, then new_context(proxy=PROXY, ...)
        context = await browser.new_context(
            locale="en-GB",
            timezone_id="Europe/London",
        )
        page = await context.new_page()

        # Confirm the exit country before the scraper runs
        response = await page.goto("https://ipinfo.io/json")
        ip_info = await response.json()
        if ip_info.get("country") != "GB":
            raise RuntimeError(f"Unexpected exit country: {ip_info.get('country')}")
        print(f"Exit IP {ip_info['ip']} in {ip_info['country']} ({ip_info['timezone']})")

        await page.goto("https://books.toscrape.com/")
        await page.wait_for_selector("article.product_pod")
        titles = await page.locator("article.product_pod h3 a").evaluate_all("links => links.map(a => a.title)")

        for title in titles[:5]:
            print(f"Extracted: {title}")

        await browser.close()

asyncio.run(scrape_with_proxy())
```

Rotating proxies can switch IPs on every request, so pin the exit country. With IPRoyal Residential Proxies, add *\_country-gb* (or another two-letter country code) to your password. Then match your *timezone\_id* and *locale* language settings to it, along with the plugin's *navigator\_languages\_override,* which defaults to US English.

from $1.75/GB

Global Pool, Precise Targeting, Zero Contracts

Premium Residential Proxies

[Buy Residential Proxies](https://iproyal.com/blog/playwright-stealth/residential-proxies/)

Set *navigator\_platform\_override* to match the operating system in your user agent, as it defaults to *Win32.* Leave *user\_agent* unset, so the plugin derives it from the real browser version and keeps it in line with the Sec-CH-UA header it adds.

Before it re-runs the *books.toscrape.com* scrape, the script checks the exit country at *ipinfo.io* and stops if it isn't GB, so your browser settings match the IP location the site sees. The plugin applies one language override to every context it patches, so use one exit country per *Stealth()* instance.

## Conclusion

Playwright Stealth is a quick way to patch the most obvious automation signals, such as *navigator.webdriver* and the HeadlessChrome user agent, with one context manager. Test it against a fingerprinting page before you rely on it, keep your timezone and locale in line with your proxy, and expect advanced anti-bot systems to check signals it can't patch.

## FAQ

Does Playwright have built-in fingerprint patching?

No. Playwright is a library for automating Chromium, Firefox, and WebKit, used for testing and scripting, and it doesn't patch its own fingerprint. Its automated browsers report signals such as *navigator.webdriver,* so you need a third-party Python package like playwright-stealth to patch the browser properties that anti-bot systems inspect.

Does playwright-stealth work with Firefox or WebKit?

Not in a useful way. Its JavaScript patches load in any browser, but they imitate Chrome, for example by setting *navigator.vendor* to “Google Inc.”, and the launch-flag and user agent patches only run on Chromium. On Firefox or WebKit, that leaves a mixed fingerprint, so launch the Chromium engine in your Playwright scripts.

Does playwright-stealth still work in 2026?

Yes, for basic checks. Version 2.0.3 came out in April 2026 and still patches signals such as *navigator.webdriver.* It can't change your TLS fingerprint, behavioral signals, or the reputation of your IP addresses, though, and a modern anti-bot system can also spot patched browser objects at runtime.

Does Playwright Stealth work with Cloudflare or DataDome?

Usually not. These advanced anti-bot systems use JavaScript challenges, TLS fingerprinting, and behavioral analysis of user interactions, and the plugin's property overrides don't change any of those. On pages these vendors protect, expect challenges and [CAPTCHAs ](https://iproyal.com/blog/bypass-captcha/)even with every patch turned on.

Do you still need proxies with Playwright Stealth?

For scraping protected sites at any volume, usually yes. Anti-bot systems score your IP reputation from the first request, before any of your browser's JavaScript runs, so a patched fingerprint can't make up for an IP with a poor history. Requests from known datacenter and cloud provider ranges also get challenged more often.

[Create Account](https://dashboard.iproyal.com/)

[Author](https://iproyal.com/blog/authors/eugenijus-denisov/)

[Eugenijus Denisov](https://iproyal.com/blog/authors/eugenijus-denisov/)

[Lead Backend Developer](https://iproyal.com/blog/authors/eugenijus-denisov/)

With over a decade of experience under his belt, Eugenijus has worked on a wide range of projects - from LMS (learning management system) to large-scale custom solutions for businesses and the medical sector. Proficient in PHP, Vue.js, Docker, MySQL, and TypeScript, Eugenijus is dedicated to writing high-quality code while fostering a collaborative team environment and optimizing work processes. Outside of work, you’ll find him running marathons and cycling challenging routes to recharge mentally and build self-confidence.

[Learn More About Eugenijus Denisov ](https://iproyal.com/blog/authors/eugenijus-denisov/)[Meet all Writers](https://iproyal.com/blog/authors/)

Share on

### In This Article

- [What Is Playwright Stealth?](https://iproyal.com/blog/playwright-stealth/#What-Is-Playwright-Stealth)
- [How to Install and Use playwright-stealth](https://iproyal.com/blog/playwright-stealth/#How-to-Install-and-Use-playwright-stealth)
- [Testing Whether Playwright Stealth Actually Works](https://iproyal.com/blog/playwright-stealth/#Testing-Whether-Playwright-Stealth-Actually-Works)
- [Scraping a Page With Playwright Stealth](https://iproyal.com/blog/playwright-stealth/#Scraping-a-Page-With-Playwright-Stealth)
- [How to Use a Proxy With playwright-stealth](https://iproyal.com/blog/playwright-stealth/#How-to-Use-a-Proxy-With-playwright-stealth)
- [Conclusion](https://iproyal.com/blog/playwright-stealth/#Conclusion)
- [FAQ](https://iproyal.com/blog/playwright-stealth/#FAQ)

Ready to get started?

[Register now](https://dashboard.iproyal.com/register/)

Data News in Your Inbox

No spam whatsoever, just pure data gathering news, trending topics and useful links. Unsubscribe anytime.

No spam. Unsubscribe anytime.

## Related articles

[View all](https://iproyal.com/blog/category/tutorials/)

[Tutorials](https://iproyal.com/blog/the-most-common-payment-processing-obstacles-and-solutions-for-saas-companies/)

## [The Most Common Payment Processing Obstacles and Solutions for SaaS Companies](https://iproyal.com/blog/the-most-common-payment-processing-obstacles-and-solutions-for-saas-companies/)

[Here are the most common payment processing obstacles SaaS companies face and the solution that helped us focus on growth and our services!](https://iproyal.com/blog/the-most-common-payment-processing-obstacles-and-solutions-for-saas-companies/)

[August 8, 2022](https://iproyal.com/blog/the-most-common-payment-processing-obstacles-and-solutions-for-saas-companies/)

[3 min read](https://iproyal.com/blog/the-most-common-payment-processing-obstacles-and-solutions-for-saas-companies/)

[Tutorials](https://iproyal.com/blog/easy-programmatic-seo-with-wordpress/)

## [Easy Programmatic SEO with WordPress](https://iproyal.com/blog/easy-programmatic-seo-with-wordpress/)

[Our fourth and final entry in the pSEO series explains how to combine programmatic SEO with WordPress using plugins or code snippets.](https://iproyal.com/blog/easy-programmatic-seo-with-wordpress/)

[March 30, 2023](https://iproyal.com/blog/easy-programmatic-seo-with-wordpress/)

[10 min read](https://iproyal.com/blog/easy-programmatic-seo-with-wordpress/)

[Tutorials](https://iproyal.com/blog/api-for-dummies-the-coders-and-no-coders-guide/)

## [API for Dummies — The Coder’s and No-coder’s Guide](https://iproyal.com/blog/api-for-dummies-the-coders-and-no-coders-guide/)

[Learn API basics with this guide for coders and non-coders. Discover the different components of an API call.](https://iproyal.com/blog/api-for-dummies-the-coders-and-no-coders-guide/)

[June 1, 2023](https://iproyal.com/blog/api-for-dummies-the-coders-and-no-coders-guide/)

[11 min read](https://iproyal.com/blog/api-for-dummies-the-coders-and-no-coders-guide/)
