Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Playwright Android testing guide: mobile emulation, the experimental _android API, and how to run Playwright tests on real Android devices and emulators in CI.

Salman Khan
Author
July 1, 2026
Android testing is often associated with Appium and native mobile frameworks, but Playwright offers another approach for testing mobile web experiences.
Playwright Android testing points your existing browser automation at mobile Chrome, emulated or on real hardware, to catch responsive, user-flow, and rendering bugs before your users do.
Overview
Is Playwright Enough for Android Testing
Playwright fully covers Android mobile web in Chrome and WebView, but not native apps. For native screens you add Appium, and for hardware accuracy, real devices.
What Are the Ways to Test Android With Playwright
Playwright offers three approaches, from fastest to most accurate:
Playwright Android testing uses the Playwright framework to validate web behavior in mobile Chrome, either emulated or on a real Android device. It covers Chrome and WebView only, not native apps.
That scope decides everything else, and it sets Android apart from standard Playwright testing on the desktop. There are exactly three approaches on Android:
Testing native screens, system permission dialogs, or non-browser flows in an installed app is a job for Android automation testing, not Playwright.
Yes, for mobile web. Playwright supports Android two ways: device emulation through its device registry, and an experimental on-device API for Chrome and WebView. It cannot automate native apps.
Conflating these two paths is the most common mistake teams make. They are built for different jobs:
The takeaway: emulation is production grade for responsive bugs; the on-device _android path is best treated as a smoke-test tool. For stable runs on real hardware at scale, point a script at a cloud grid.
Note: Run your existing Playwright scripts on real Android devices, no adb or local setup. Start testing free or book a demo for a guided walkthrough.
No. Playwright is a browser automation framework, so it reaches only web content: Chrome for Android pages and WebView contexts. Native screens, dialogs, and gestures need Appium or Espresso instead.
State this boundary plainly so you do not burn a sprint discovering it. Four operations Playwright on Android cannot perform:
With that line drawn, the framework choice is mechanical. Match each application layer to the right tool:
Testing those WebView screens is its own workflow, and Playwright WebView testing shows how to attach to the WebView and drive it with normal locators.
You do not need two device strategies here: the same TestMu AI real device cloud runs both frameworks, so your Appium and Playwright suites execute on the same Android handsets.
Spread a device descriptor from the Playwright devices registry into your config. Each preset sets viewport, userAgent, deviceScaleFactor, isMobile, and hasTouch, so the page acts as mobile Chrome.
A two-project config covers two common Android profiles in one run:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'Pixel 5 - Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Galaxy S9+ - Chrome',
use: { ...devices['Galaxy S9+'] },
},
],
});The test itself stays framework-standard. It loads an ecommerce demo, then taps the mobile menu to confirm the touch-enabled viewport behaves like a real phone:
import { test, expect } from '@playwright/test';
test('mobile menu is reachable on Android viewport', async ({ page }) => {
await page.goto('https://ecommerce-playground.lambdatest.io/');
await expect(page).toHaveTitle(/Your Store/);
// hasTouch + isMobile are set by the Pixel 5 descriptor,
// so tap() is the correct interaction, not click()
await page.tap('button.navbar-toggler, [data-toggle="collapse"]');
});Emulation catches broken responsive breakpoints, hidden tap targets, viewport overflow, and wrong mobile user-agent branching.
What it misses: real GPU rendering, OEM browser quirks (Samsung Internet behaves differently from stock Chrome), touch latency, and memory limits on low-end hardware. Treat emulation as the cheapest layer, not the final word.
I learned that the hard way: an emulation-only suite stayed green while a Samsung Internet rendering bug shipped to users.
The _android entry point connects Playwright to Chrome or a WebView on a locally attached Android device or emulator. The official docs mark it experimental, so it suits quick local smoke checks only.
Four prerequisites are stated in the Playwright Android documentation:
const { _android: android } = require('playwright');
(async () => {
const [device] = await android.devices();
console.log('Model:', device.model(), 'Serial:', device.serial());
await device.shell('am force-stop com.android.chrome');
const context = await device.launchBrowser();
const page = await context.newPage();
await page.goto('https://ecommerce-playground.lambdatest.io/');
console.log(await page.title());
await context.close();
await device.close();
})();Useful methods include android.devices() to detect hardware, device.launchBrowser() for a Chrome context, and android.launchServer() to expose a device for remote connections.
The honest assessment: this path is fine for a quick local check, but its experimental status and one-device-per-machine setup make it impractical for CI. That is why teams move execution to a cloud grid.
You have two routes to a real Android device: attach a physical phone locally over adb, or connect to a cloud device over the Chrome DevTools Protocol with no local hardware or setup.
The local route reuses the experimental _android API from the previous section on an attached phone. It suits one device on your desk, not CI.
Cloud execution runs on TestMu AI (formerly LambdaTest), a platform that executes your existing Playwright scripts on real Android devices over CDP, with no device lab to maintain.
For a real-device Playwright run, the platform gives you:
See the real device cloud for the supported device list and capabilities, and the Playwright Android documentation for setup details.
To implement it, create a free account, then copy your username and access key into the LT_USERNAME and LT_ACCESS_KEY variables the script reads.
Because the platform was formerly LambdaTest, the endpoint (cdp.lambdatest.com), the LT:Options block, and those credentials all still carry the legacy lambdatest name:
const { chromium } = require('playwright-core');
const capabilities = {
'LT:Options': {
platformName: 'android',
deviceName: 'Galaxy S22 5G',
platformVersion: '12',
isRealMobile: true,
build: 'Playwright Android Blog Demo',
name: 'Open ecommerce playground on real Android',
user: process.env.LT_USERNAME,
accessKey: process.env.LT_ACCESS_KEY,
},
};
(async () => {
const cdpUrl =
'wss://cdp.lambdatest.com/playwright?capabilities=' +
encodeURIComponent(JSON.stringify(capabilities));
const browser = await chromium.connect(cdpUrl);
const page = await browser.newPage();
await page.goto('https://ecommerce-playground.lambdatest.io/');
console.log('Title:', await page.title());
await page.close();
await browser.close();
})();While writing this guide, I connected this exact script to the TestMu AI CDP endpoint and hit a constraint worth knowing first.
The platform supports Playwright up to v1.59.0 for Android. A newer local Playwright (v1.60.0) is rejected at the handshake: "Playwright version 1.60.0 not supported for android platform."
Pin a supported client such as [email protected] before you connect.
Once connected, every run streams to the automation dashboard with video, network logs, and console output, the artifacts shown below.

The same connection that runs one device scales to the full Android matrix in CI, turning one script into release-grade coverage on every commit.
Use emulation for responsive checks on every commit, and real devices before release. Emulation validates layout cheaply; real devices catch GPU rendering, OEM quirks, touch, and performance issues.
This decision table maps a scenario to the right Playwright Android approach:
| Scenario | Best Approach | Why |
|---|---|---|
| Responsive layout check on every commit | Device emulation | Runs in seconds in CI with no device cost; catches broken breakpoints early. |
| Quick local check on one attached phone | Experimental _android API | Drives on-device Chrome without a cloud, accepting its experimental limits. |
| Pre-release regression across OEMs | Real device cloud | Reproduces GPU rendering and OEM browser quirks emulation cannot. |
| Parallel runs across many devices in CI | Real device cloud plus HyperExecute | Scales one suite across handsets with up to 70% faster orchestration. |
| Native screens, gestures, or system dialogs | Appium (not Playwright) | Playwright reaches web and WebView content only. |
Treat mobile as a Playwright project, gate every commit with fast emulation, then validate release candidates on real Android hardware. Pin a supported version and keep native flows in Appium.
Each practice below comes from the framework constraints covered above, applied to a real suite:
For headless execution tradeoffs on mobile Chrome, see the guide on Playwright headless testing.
Start by adding one Android emulation project to your existing Playwright config and running it in CI this week. It is a five-minute change that catches responsive bugs immediately.
When you are ready for hardware accuracy, point the same script at a real Galaxy or Pixel using the CDP config above, and keep Appium in your toolkit for native screens.
To run Playwright on real Android phones without a device lab, create a free account and scale across 10,000+ real devices on TestMu AI. Your users test on real hardware daily; yours should too.
Author
Salman is a Test Automation Evangelist and Community Contributor at TestMu AI, with over 6 years of hands-on experience in software testing and automation. He has completed his Master of Technology in Computer Science and Engineering, demonstrating strong technical expertise in software development, testing, AI agents and LLMs. He is certified in KaneAI, Automation Testing, Selenium, Cypress, Playwright, and Appium, with deep experience in CI/CD pipelines, cross-browser testing, AI in testing, and mobile automation. Salman works closely with engineering teams to convert complex testing concepts into actionable, developer-first content. Salman has authored 120+ technical tutorials, guides, and documentation on test automation, web development, and related domains, making him a strong voice in the QA and testing community.
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance