Route Playwright browser traffic through LundProxy.
Route Playwright browser traffic through LundProxy. This example uses Rotating Proxies as the default gateway and can be adapted by replacing endpoint and routing credentials.
Install the client and create a file.
Use a clean project environment and pin tested dependency versions for production. The example target is a public scraping sandbox.
python -m pip install playwright && playwright install chromiumLoad proxy secrets from the environment.
The proxy username is not the LundProxy website login. Copy the complete username and password generated for the selected proxy product.
PROXY_USER=user-pool-crawlerPROXY_PASS=your-secretbrowser.py
Copy the code into the named file, set credentials, and run it from the project environment.
import asyncio
import os
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as playwright:
browser = await playwright.chromium.launch(
headless=True,
proxy={
"server": "http://proxy.lundproxy.com:36923",
"username": os.environ["PROXY_USER"],
"password": os.environ["PROXY_PASS"],
},
)
context = await browser.new_context()
page = await context.new_page()
await page.goto(
"https://quotes.toscrape.com/js/",
wait_until="domcontentloaded",
timeout=30_000,
)
print(await page.locator(".quote").count())
await browser.close()
asyncio.run(main())
Keep the important behavior visible.
Add workload-specific controls before scale.
Test representative targets, response sizes, routing policy, concurrency, retries, validation, and completion window. Collect only public data you are authorized to access.
Playwright questions.
Can the proxy change inside one browser context?
Treat proxy configuration as context or browser scoped. Create a new context or browser when the routing identity must change.
Why is traffic higher than an HTTP request?
The browser loads scripts, styles, images, fonts, and APIs.
How should I block unnecessary resources?
Use route handlers only when those resources are not required for page behavior or validation.