AI & Automation

What is Playwright?

Playwright is Microsoft's browser automation library. A single API drives Chromium, Firefox and WebKit, with official bindings for JavaScript, Python, .NET and Java. It has auto-waiting, isolated browser contexts, per-context proxy settings and a trace viewer that replays a failed run step by step, which makes it the usual pick for new automation projects.

The object model has three layers. A browser is the process, a context is an isolated profile with its own cookies, storage and permissions, and a page is a tab inside that context. Contexts are cheap, so a script can hold a dozen independent logins at once without launching a dozen browsers. Locators re-resolve the element each time they are used, and every action runs actionability checks first, waiting for the node to be attached, visible and stable before clicking. Most of the sleep calls that pad older automation code disappear.

Playwright takes proxy settings as part of its API. You pass a proxy object with server, username, password and an optional bypass list, either to the launch call or to browser.newContext(). Per-context proxying is the practical advantage, since each context can leave through a different exit IP while keeping its own cookie jar, which maps onto one-identity-per-account work. Combine it with storageState to save and reload a signed-in session, and a run can resume without repeating the login flow.

The bundled Chromium is not branded Chrome, so it lacks proprietary codecs and Widevine, and it reports itself accordingly. Setting channel to 'chrome' or 'msedge' runs the installed stable browser instead, which is closer to what a real user sends. Recent releases run Chromium's newer headless mode, where headless and headful share one binary and behave much more alike. None of that hides automation on its own; navigator.webdriver, timing patterns and IP reputation still feed whatever risk engine is watching.

Operationally, Playwright brings tooling the others make you build. Codegen records a session into working code. The trace viewer stores DOM snapshots, network logs and screenshots for a failed run, which turns flaky-test archaeology into a few clicks. route() intercepts requests, so you can abort images and analytics and cut a crawl's bandwidth substantially. The test runner shards across workers and browsers, and the official Docker image already carries the system libraries that WebKit and Firefox need.

Where you meet it

You reach for Playwright when a scrape needs a real rendering engine, or when a test suite has to prove a flow works in Safari's engine as well as Chrome. The decision it forces early is how to slice identities: one context per account with its own proxy and storage state, or one browser per account. Get that wrong and cookies bleed between accounts, which is how linked-account bans start.

Common questions

Can each Playwright browser context use a different proxy?

Yes. Pass a proxy object to browser.newContext() and that context exits through its own address while sharing the browser process. Each context keeps separate cookies and local storage, so several accounts can run in parallel without leaking state between them. Credentials go in the same object as username and password.

Does Playwright rotate IP addresses by itself?

No. Playwright sets whatever proxy you give it and nothing more. Rotation comes from the proxy side, either by pointing at a rotating endpoint that issues a new address per request or per session, or by assigning a different proxy to each new context in your own code.

Is Playwright better than Selenium for scraping?

For most new work, yes. Auto-waiting removes a large class of race conditions, request interception and proxy credentials are first-class, and one API covers three engines. Selenium keeps the edge where an existing Grid or a commercial device lab already speaks WebDriver, and where the team writes its tests in Java or C#.

Related terms

Puppeteer
Puppeteer is a Node.js library that drives Chrome and Chromium through the Chrome DevTools Protocol. From JavaScript it launches a browser, opens pages, clicks and types, intercepts network traffic and renders screenshots or PDFs. Teams run it to scrape pages that only assemble their content after JavaScript executes, and to automate logged-in workflows.
Selenium
Selenium is a browser automation framework that drives real browsers through the W3C WebDriver protocol. It has official bindings for Java, Python, C#, Ruby and JavaScript, and Selenium Grid spreads runs across many machines. Long-standing use makes it the default in enterprise QA, though newer libraries handle waiting and proxy credentials with far less code.
AI Agent
An AI agent is a program that lets a language model choose its own next action toward a goal, calling tools such as a browser, an HTTP client or a shell between reasoning steps and feeding each result back into its context. A fixed script sets the order in advance; an agent derives it from what the last step returned.
MCP
MCP, the Model Context Protocol, is an open standard for connecting AI assistants to external tools and data. A server declares the tools, resources and prompts it provides; a client such as Claude Desktop, Claude Code or an IDE discovers them at runtime over JSON-RPC and calls them on the model's behalf, so one integration works across every compatible assistant.
Browser Automation
Browser automation is the scripted control of a real browser, navigating, clicking, typing and reading the rendered DOM in place of a person doing it by hand. Playwright, Puppeteer and Selenium drive Chromium, Firefox and WebKit over a debugging or WebDriver protocol, headless or with a visible window, for testing, scraping and agent work.
Scrapy
Scrapy is an open-source Python framework for large-scale web crawling. Its asynchronous engine keeps many requests in flight at once, while spiders, item pipelines and downloader middlewares keep parsing separate from transport. Proxies plug into the middleware chain, so a crawl can change exit IP addresses without any edit to spider code.
API
An API (application programming interface) is a defined contract that lets one program call another. On the web that usually means HTTP endpoints returning JSON, with an authentication header, documented parameters and stable error codes. Proxy providers publish APIs so a script can list endpoints, trigger an IP rotation or read bandwidth usage without anyone opening a dashboard.

Real 4G/5G mobile and residential IPs

PROXIES.SX runs carrier IPs in 100+ countries with HTTP and SOCKS5 on every endpoint. $4/GB down to $2.40/GB at volume, free endpoints and rotation, and your GB never expire.