What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To run Playwright in the cloud, keep Playwright as your client and replace the local chromium.launch() call with a WebSocket connection to a managed browser. For a Chromium session, the usual migration is chromium.connectOverCDP(). If you need Playwright’s full protocol, Firefox or WebKit, or APIs such as network routing, use the provider’s native Playwright endpoint with browserType.connect() instead.
The remote browser performs the work, so your code still creates pages, uses locators, waits for UI state and runs assertions. You can therefore move CI jobs off heavyweight browser images without rewriting test logic, provided you account for network latency, authentication, context behavior, provider limits and cleanup.
What changes when the browser is remote?
A local script normally launches a browser binary on the same machine:
const browser = await chromium.launch();
With a cloud browser, the browser process already exists in the provider’s infrastructure. Your process opens a WebSocket and controls that session:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
const browser = await chromium.connectOverCDP('wss://provider.example/?token=TOKEN');
After connecting, normal Playwright objects remain available: contexts, pages, locators, screenshots, waits and assertions. Your test code is remote-control code; the browser, rendering and network activity happen elsewhere.
Choose CDP or the native Playwright protocol
Use connectOverCDP() for Chromium
Playwright defines connectOverCDP() as attaching to an existing browser through the Chrome DevTools Protocol. It supports Chromium-based browsers only and has lower fidelity than Playwright’s native connection. It is often more tolerant when your client and the provider’s browser versions are not identical.
CDP is a good fit for page automation, scraping, visual capture and tests that use standard browser APIs. It also avoids installing a local browser binary when the provider supplies the browser.
Use browserType.connect() for full Playwright features
Choose the provider’s native Playwright WebSocket endpoint when you need Playwright-protocol features such as page.route() network interception or APIRequestContext, or when your matrix includes Firefox or WebKit. Native connections provide higher API fidelity, but the endpoint is tied more closely to the Playwright version running there; keep client and endpoint versions aligned.
Recommended Free Tools
| Requirement | Better connection | Reason |
|---|---|---|
| Chromium page automation | connectOverCDP() |
Simple attachment and broader client-version tolerance |
| Firefox or WebKit | Native browserType.connect() |
CDP is Chromium-only |
page.route(), API request contexts |
Native connection | Higher Playwright-protocol fidelity |
| Mixed provider/client versions | Usually CDP | CDP is generally more tolerant, though compatibility still needs verification |
JavaScript: connect Playwright to a cloud browser
Install the client without downloading browsers
When the remote service supplies the browser, install playwright-core to avoid downloading local browser binaries:
npm install playwright-core
Use the provider’s tokenized WebSocket endpoint. The following pattern uses the documented Browserless production endpoint and closes the session even when navigation or assertions fail:
Rank #2
import { chromium } from 'playwright-core';
const token = process.env.BROWSERLESS_TOKEN;
if (!token) throw new Error('Set BROWSERLESS_TOKEN');
const browser = await chromium.connectOverCDP(
`wss://production-sfo.browserless.io?token=${encodeURIComponent(token)}`
);
try {
const context = browser.contexts()[0];
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
console.log(await page.title());
} finally {
await browser.close();
}
The existing default context is important. A provider may attach extensions, a proxy or other launch-level settings to it. Calling browser.newContext() creates a separate context and, as Browserless cautions, does not inherit those settings.
Native Playwright connection
If your provider supplies a native Playwright endpoint, the shape is:
import { chromium } from 'playwright-core';
const browser = await chromium.connect('wss://provider.example/playwright?token=TOKEN');
try {
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
} finally {
await browser.close();
}
Use the provider’s documented endpoint and the matching Playwright client version. Do not substitute a CDP URL for a native endpoint or vice versa.
Python: remote Playwright sessions
Install and connect over CDP
pip install playwright
Python’s async API mirrors JavaScript. The remote browser means you do not need to run playwright install for the provider’s browser:
import asyncio
import os
from playwright.async_api import async_playwright
async def main():
token = os.environ["BROWSERLESS_TOKEN"]
endpoint = f"wss://production-sfo.browserless.io?token={token}"
async with async_playwright() as pw:
browser = await pw.chromium.connect_over_cdp(endpoint)
try:
context = browser.contexts[0]
page = await context.new_page()
await page.goto("https://example.com", wait_until="domcontentloaded")
print(await page.title())
finally:
await browser.close()
asyncio.run(main())
For native Playwright mode, replace connect_over_cdp() with the provider’s supported connect() call and use the browser engine that the endpoint exposes.
What happens to launch options?
Options that would be arguments to a local launch commonly move into the provider’s WebSocket URL as query parameters. Browserless documents options including ad blocking, timeouts, saved profiles and CAPTCHA solving. Follow the provider’s exact parameter names and URL-encode values; a malformed query string can produce an apparently valid connection with settings silently ignored.
Rank #3
Authentication and secrets
- Keep the token in an environment variable or secret manager, never in source control or a client-side bundle.
- Use a separate token per CI environment when the provider supports it, so revocation and usage analysis are practical.
- Redact the full WebSocket URL from logs. It contains the credential.
Proxy and geography
Playwright’s browser API supports HTTP and SOCKS proxies, including bypass rules, usernames and passwords. In a managed service, proxy and location settings may instead be URL parameters or account settings. Confirm which layer owns the proxy before creating a context. A context created after connection may not inherit launch-level proxy configuration.
Local browser installation versus cloud execution
| Area | Local launch | Cloud browser |
|---|---|---|
| Browser binaries | You install versions supported by your Playwright release with npx playwright install. |
Provider maintains the browser; playwright-core can avoid local downloads. |
| Runtime control | Direct control of OS, files, processes and browser flags. | Centralized browser management, but provider limits and policies apply. |
| CI image size | Browser binaries and system dependencies increase image size. | Smaller client image; every action crosses the network. |
| Engine coverage | Chromium, Firefox and WebKit when installed. | Depends on the endpoint; CDP is Chromium-only. |
| Failure surface | Local dependencies, certificates and display/runtime issues. | Tokens, WebSocket reachability, session quotas, latency and provider availability. |
Playwright releases require specific browser binaries. In a local or self-hosted environment, npx playwright install downloads those supported versions. Proxies may require HTTPS_PROXY and custom CA configuration. A cloud browser removes that installation step, not the need to manage network security and version compatibility.
Reliable remote-session practices
Close every session
Put browser.close() in a finally block. A failed assertion must not leave a managed session consuming a concurrency slot.
Wait for state, not arbitrary sleeps
Prefer locator assertions, a selector wait or a documented network-idle condition. Remote latency makes fixed short sleeps flaky; fixed long sleeps waste session time. Set explicit navigation and operation timeouts appropriate to your application.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Design for latency
- Group related actions in one session instead of reconnecting for every page.
- Avoid downloading large assets when the test does not need them; use the provider’s request blocking where appropriate.
- Capture traces, console output and failure screenshots before closing the browser.
- Keep retries bounded. Re-running an entire remote session can multiply cost and hide deterministic defects.
Plan concurrency
Cloud services enforce session or concurrency limits. A test runner that starts more workers than the account allows will see queued sessions, connection failures or throttling. Size workers to the provider’s documented limit and add backoff for transient WebSocket errors.
Troubleshooting connection and test failures
“WebSocket connection failed”
Check the endpoint scheme (wss://), token, firewall egress and URL encoding. Corporate proxies sometimes block WebSockets; test from the same CI network and configure the proxy or allowlist the provider host.
“Browser disconnected” during a test
The session may have hit a provider timeout, concurrency limit or browser crash. Reduce idle time, verify the service’s session timeout, and ensure only one worker uses a session. Reconnect and retry only idempotent setup steps.
Pages open with the wrong proxy or profile
You probably created a new context instead of using the provider’s existing default context. Try browser.contexts()[0] first, and move proxy/profile settings to the provider URL when required.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Playwright method is missing
That is often a protocol mismatch: CDP exposes less than native Playwright. Switch to the provider’s native endpoint for features such as page.route(), or redesign the step using APIs available over CDP.
Local install errors despite using a cloud browser
Check that your package is not launching a local engine elsewhere in the code or in a test runner configuration. Use playwright-core for a client-only JavaScript installation, and remove unnecessary browser-install steps from the image.
Authentication works locally but not remotely
Remote sessions have a different IP, timezone, user agent and possibly geolocation. Supply required headers, cookies or provider options explicitly, and avoid assuming local filesystem state exists in the cloud.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is a clean website image or PDF rather than interactive test automation, ScreenshotNeo makes the capture a single request. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.
Start with the documented API examples at ScreenshotNeo’s documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. It supports full-page and element captures, device presets, custom viewports, retina scale, PDF page settings, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it.
Cost and operational decisions
Cloud-browser pricing depends on the provider’s session, minute or usage model; the cited technical documentation does not establish a universal rate. Measure the work your suite actually performs: browser startup, navigation waits, retries, parallel workers and idle time. Keep sessions short, reuse a connection for related steps and stop failed jobs promptly. Compare that operational cost with maintaining browser binaries, system packages, CI minutes and debugging time in local images.
For screenshot-only workloads, a screenshot API can be simpler than paying for an interactive browser session. ScreenshotNeo’s billing headers let an application distinguish clean, billable captures from failures and cache hits, which is useful when you need predictable handling of unsuccessful URLs.
Decision checklist
- Choose CDP only when Chromium and its lower API fidelity are acceptable.
- Choose native Playwright for Firefox, WebKit or advanced Playwright protocol APIs.
- Confirm the provider’s endpoint, token format, supported Playwright version and concurrency policy.
- Use the existing default context when inherited proxy, profile or extension settings matter.
- Store tokens securely and redact WebSocket URLs.
- Close every browser in a
finallyblock. - Use state-based waits, bounded retries and evidence such as traces or screenshots.
Frequently Asked Questions
Can I run headed mode on a cloud browser?
That depends on the provider’s session capabilities and endpoint options. Many managed sessions are intended for headless execution; check the service documentation before relying on a visible display.
Should I use one remote browser per test?
Use isolation appropriate to your test data, but avoid unnecessary reconnects. A single connection can host multiple contexts or pages when your provider’s limits and isolation requirements permit it.
Is CDP suitable for Firefox tests?
No. Playwright’s CDP attachment is for Chromium-based browsers. Use a native Playwright connection and a provider that exposes Firefox when cross-engine coverage is required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

