Version: 1.10.0


Playwright has experimental support for Android automation. You can access android namespace via:

const { _android: android } = require('playwright');

An example of the Android automation script would be:

const { _android: android } = require('playwright');
(async () => {
// Connect to the device.
const [device] = await android.devices();
console.log(`Model: ${device.model()}`);
console.log(`Serial: ${device.serial()}`);
// Take screenshot of the whole device.
await device.screenshot({ path: 'device.png' });
// --------------------- WebView -----------------------
// Launch an application with WebView.
await'am force-stop org.chromium.webview_shell');
await'am start org.chromium.webview_shell/.WebViewBrowserActivity');
// Get the WebView.
const webview = await device.webView({ pkg: 'org.chromium.webview_shell' });
// Fill the input box.
await device.fill({ res: 'org.chromium.webview_shell:id/url_field' }, '');
await{ res: 'org.chromium.webview_shell:id/url_field' }, 'Enter');
// Work with WebView's page as usual.
const page = await;
await page.waitForNavigation({ url: /.*microsoft\/playwright.*/ });
console.log(await page.title());
// --------------------- Browser -----------------------
// Launch Chrome browser.
await'am force-stop');
const context = await device.launchBrowser();
// Use BrowserContext as usual.
const page = await context.newPage();
await page.goto('');
console.log(await page.evaluate(() => window.location.href));
await page.screenshot({ path: 'page.png' });
await context.close();
// Close the device.
await device.close();

Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:



Returns the list of detected Android devices.


  • timeout <number> Maximum time in milliseconds

This setting will change the default maximum time for all the methods accepting timeout option.