XDriver patches Playwright with a single command to bypass anti-bot systems and make your scraping sessions block-free. It modifies driver, CDP connections and python wrapper, helping you avoid detection.
You can install XDriver using pip
:
$ pip install x_driver
To patch your Playwright installation for stealth scraping, run:
$ x_driver activate
This command modifies Playwright’s source code to bypass common bot detection systems, making your scraping scripts more undetectable.
Once XDriver is activated, you can run your Playwright scripts just like you normally would—no additional changes needed.
Here's a basic example:
import asyncio
import re
from playwright.async_api import Playwright, async_playwright, expect
async def run(playwright: Playwright) -> None:
browser = await playwright.chromium.launch(headless=False)
context = await browser.new_context()
page = await context.new_page()
await page.goto("http://example.com/")
await context.close()
await browser.close()
async def main() -> None:
async with async_playwright() as playwright:
await run(playwright)
asyncio.run(main())
XDriver ensures your Playwright instance is patched for stealth, allowing you to scrape without getting blocked
To restore Playwright to its original state, run:
$ x_driver deactivate
This safely reverts all changes made by XDriver, returning Playwright to its default configuration.