BLOG
Hosted Chromium Android: Run Mobile Web Sessions in the Cloud
Hosted Chromium Android gives agents and test suites a real mobile browser without a device farm. Learn how CDP, profiles, and proxies fit together.
# Hosted Chromium Android: Run Mobile Web Sessions in the Cloud
"Hosted Chromium Android" describes a specific setup: a Chromium-based browser running in a cloud environment that presents itself as an Android device, reachable over a network protocol rather than through a physical phone or emulator on your laptop. Teams search for this because mobile web behavior diverges from desktop in ways that break automation — touch events, viewport constraints, user-agent gating, and layout differences all matter. This guide covers what hosted Chromium Android actually is, where it fits, and how to wire it into a Playwright or Puppeteer workflow without pretending it replaces a full device farm.
What "Hosted Chromium Android" Actually Means
There are three distinct things people conflate under this term, and the distinction matters before you commit engineering time.
1. Chromium running on an Android host. The browser process executes inside an Android runtime (emulator or containerized Android). This gives you the closest fidelity to a real Android Chrome — real touch input, real Android WebView behavior, real device APIs. It is also the heaviest option: boot times, resource cost, and orchestration complexity are all higher.
2. Desktop Chromium with an Android device profile. The browser runs on a Linux host, but the session is configured with a mobile viewport, an Android user-agent string, touch emulation enabled, and device scale factor set. This is what Playwright's devices['Pixel 7'] presets do. It is fast, cheap, and reproducible — but it is not Android. Sites that fingerprint at the OS level, or that depend on genuine Android APIs, will still see a desktop Linux host underneath.
3. A hosted runtime that exposes either of the above over CDP. This is the layer most production teams actually want. Whether the underlying browser is Android-native or a mobile-emulated Chromium, the important property is that it lives in the cloud, is addressable by a WebSocket endpoint, and can be driven by Playwright, Puppeteer, or Selenium without local installation.
Remote Browser provides the third layer: hosted Chromium sessions with CDP access, configurable browser settings including mobile viewport and user-agent parameters, persistent profiles, and a live viewer for debugging. If you need genuine Android OS fidelity — testing an APK's WebView, for example — you need a device farm or an Android emulator host, and no amount of CDP configuration substitutes for that. Be honest with yourself about which of the three you need.
Why Teams Move Mobile Browser Work Off Local Machines
The case for hosting is the same as it is for desktop automation, but the pain is sharper.
- Emulator boot cost. A cold Android emulator start can take a minute or more. If your CI job spins one up per test, you are paying that cost repeatedly. A hosted session that is already warm removes it from the critical path.
- Resource contention. Android emulators are memory-hungry. Running several in parallel on one CI runner is a fast route to OOM kills and flaky results.
- Environment drift. Local emulator images, SDK versions, and system images drift between developer machines and CI. A hosted runtime pins the environment.
- Debugging blind spots. When a mobile-only bug appears in CI and you cannot see the screen, you are guessing. A live viewer turns that into a five-minute diagnosis.
- Session persistence. Mobile flows often involve multi-step authentication, OTP handling, or cart state. Persistent profiles let a session survive across steps without re-authenticating.
The trade-off is control. You give up the ability to install arbitrary Android system images or patch the emulator. For most web automation — scraping, agent task execution, regression testing of responsive layouts — that trade is worth it. For WebView-specific or native-API testing, it is not.
Hosted Chromium Android vs. Local Emulator vs. Device Farm
| Approach | Fidelity | Startup cost | Parallelism | Debugging | Best for |
|---|---|---|---|---|---|
| Local Android emulator | High (real Android) | High (30–90s cold) | Limited by host RAM | ADB + screen capture | WebView/APK testing, native APIs |
| Hosted Chromium, mobile profile | Medium (emulated) | Low (seconds) | Scales with runtime | Live viewer + CDP | Responsive testing, agent tasks, scraping |
| Physical device farm | Highest | Very high (queueing) | Expensive | Vendor tooling | Pre-release certification, hardware sensors |
| Hosted Chromium, Android host | High | Medium | Moderate | Depends on provider | When you need Android fidelity without owning devices |
The middle two rows are where most teams land. If your requirement is "the site should render and behave like it does on a phone," a hosted Chromium session with a mobile profile is usually sufficient and dramatically cheaper. If your requirement is "the site must believe it is a Pixel 7 running Android 14," you need the bottom row, and you should budget accordingly.
Connecting to a Hosted Session Over CDP
The connection mechanism is the same regardless of whether the underlying browser is Android-native or mobile-emulated. You get a CDP WebSocket endpoint and connect to it. Playwright exposes this through chromium.connectOverCDP(), which is documented in the Playwright CDP guide.
import { chromium, devices } from 'playwright';
// The endpoint comes from your hosted session — treat it as a secret.
const wsEndpoint = process.env.REMOTE_BROWSER_WS_ENDPOINT!;
async function runMobileSession() {
const browser = await chromium.connectOverCDP(wsEndpoint, {
timeout: 30_000,
});
// Reuse the existing context the hosted session already created.
const context = browser.contexts()[0] ?? await browser.newContext({
...devices['Pixel 7'],
locale: 'en-US',
timezoneId: 'America/New_York',
});
const page = await context.newPage();
await page.goto('https://example.com', {
waitUntil: 'domcontentloaded',
timeout: 45_000,
});
// Touch-aware interaction: tap rather than click.
await page.getByRole('button', { name: 'Menu' }).tap();
const viewport = page.viewportSize();
console.log('Viewport:', viewport);
// Do NOT call browser.close() if the session is managed and
// you intend to reuse it. Disconnect instead.
await browser.close();
}
runMobileSession().catch((err) => {
console.error('Session failed:', err);
process.exit(1);
});A few production notes on this snippet:
- `connectOverCDP` vs `connect`.
connectOverCDPattaches to an existing browser process.connectis for Playwright's own server protocol. For a hosted Chromium endpoint, CDP is the right choice, and it is Chromium-only — Firefox and WebKit do not expose CDP. - Context reuse. A hosted session often arrives with a context already open. Creating a second one is fine but wastes memory; check
browser.contexts()first. - Disconnect semantics. If your provider meters by browser-hour, closing the browser ends the session. Disconnecting without closing may leave it running and billable. Know which behavior your runtime implements — see /pricing for how Remote Browser meters sessions.
- Timeouts. Mobile networks and cold caches make
gotoslower than you expect. Set explicit timeouts rather than relying on defaults.
Configuring the Session for Mobile Behavior
Getting the connection right is half the work. The other half is making the session behave like a phone.
Viewport and device scale. Set both. A 412×915 viewport with deviceScaleFactor: 2.625 renders differently from the same viewport at scale 1, and sites that use window.devicePixelRatio for asset selection will notice.
Touch emulation. Enable hasTouch: true and isMobile: true in the context options. Without these, page.tap() throws and hover states fire on elements that should only respond to touch.
User agent. Set it explicitly rather than relying on the provider's default. If your target site gates content on UA, you want that string under version control, not buried in runtime config.
Locale and timezone. These affect date formatting, currency, and sometimes content gating. Pin them so results are reproducible.
Persistent profiles. For multi-step flows, a persistent profile keeps cookies, localStorage, and IndexedDB across sessions. This is the difference between an agent that re-authenticates every run and one that stays logged in. It also means you need a policy for profile lifecycle — stale profiles accumulate, and a profile tied to a banned account is worse than no profile.
Proxy and network settings. Mobile traffic often needs a specific egress region or carrier-like IP profile. Remote Browser supports configurable proxy settings per session; check /documentation for the current options rather than assuming a specific capability.
Where Hosted Chromium Android Fits in an Agent Stack
For AI agents, the mobile profile matters more than it used to. A growing share of consumer-facing sites serve different DOM structures to mobile user agents — lighter markup, different navigation patterns, lazy-loaded content behind touch gestures. An agent trained or prompted against desktop layouts will misidentify elements on the mobile variant.
The practical pattern:
- Detect the target's mobile behavior. Load the page with a desktop UA and a mobile UA, diff the DOM. If they differ materially, run the agent against the mobile profile.
- Pin the profile per task type. Don't let the agent choose its own viewport. Task definitions should carry the device profile.
- Use the live viewer during development. Watching an agent tap the wrong element because a touch target is 20px off is far faster than reading a stack trace.
- Keep sessions short where possible. Long-lived sessions accumulate state that makes failures non-reproducible. Persistent profiles are for authentication, not for indefinite reuse.
If you are building this from scratch, the remote browser for AI agents piece covers the runtime layer in more depth, and remote browser online covers the no-local-install setup path.
Production Criteria Before You Commit
Before standardizing on any hosted Chromium Android approach, verify these against your actual workload:
- Does the provider expose raw CDP? If you only get a high-level API, you lose the ability to use Playwright's full surface. CDP access is the escape hatch that keeps you from being locked in.
- What is the session lifecycle? Explicit create/destroy, or implicit on connect? Implicit lifecycles are convenient until you leak sessions.
- How is isolation enforced? Sessions should not share cookies, storage, or process state unless you deliberately opt in via a profile.
- What does the viewer show? A live view is table stakes. Screenshot-on-failure and network log capture are what you actually need at 2am.
- How is usage metered? Browser-hours, sessions, or requests? The answer determines whether a runaway agent costs you cents or hundreds. Remote Browser's current model is documented at /pricing.
- Can you pin the browser build? Chromium ships breaking changes. If the provider auto-updates, your tests will break on their schedule, not yours.
What Hosted Chromium Android Is Not
It is not a substitute for a device farm when you need genuine hardware sensors, real cellular network conditions, or native Android API access. It is not a way to bypass a site's mobile detection if that detection is based on OS-level signals rather than user-agent and viewport. And it is not a magic fix for flaky tests — if your selectors are brittle on desktop, they will be brittle on mobile too.
What it is: a fast, reproducible, debuggable way to run Chromium sessions configured for mobile web behavior, addressable over CDP, without maintaining emulators or devices. For the majority of agent and automation workloads that touch mobile web, that is the right trade. For the minority that need true Android, it is not — and knowing which category you are in before you build is the most valuable decision in this whole process.
Start with a single task, run it against both a desktop and a mobile profile, and compare the failure modes. That comparison will tell you more about your requirements than any architecture diagram.