playwright/docs/mobile.md
2021-01-01 15:17:27 -08:00

5.6 KiB

id title
mobile Experimental support for Chrome for Android

You can try Playwright against Chrome for Android today. This support is experimental. Support for devices is tracked in the issue #1122.

Requirements

  • Playwright 1.6 or newer

  • ADB daemon running and authenticated with your device.

  • Chrome 87 or newer installed on the device

  • "Enable command line on non-rooted devices" enabled in chrome://flags.

    Playwright will be looking for ADB daemon on the default port 5037. It will use the first device available. Typically running adb devices is all you need to do.

How to run

const { _clank } = require('playwright');

(async () => {
  const context = await _clank.launchPersistentContext('', {
    viewport: null
  });
  const [page] = context.pages();
  await page.goto('https://webkit.org/');
  console.log(await page.evaluate(() => window.location.href));
  await page.screenshot({ path: 'example.png' });
  await context.close();
})();

Clank is a code name for Chrome for Android.

Known limitations