This package has been deprecated

Author message:

This package won't get updated anymore, please refer to the main Playwright package: https://playwright.dev/docs/api/class-android

playwright-android
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

playwright-android

This package contains the Android flavor of Playwright.

Requirements

  • Android device or AVD Emulator.
  • ADB daemon running and authenticated with your device. Typically running adb devices is all you need to do.
  • Chrome 87 or newer installed on the device
  • "Enable command line on non-rooted devices" enabled in chrome://flags.

How to demo

const { android } = require('playwright-android');

(async () => {
  const [device] = await android.devices();
  console.log(`Model: ${device.model()}`);
  console.log(`Serial: ${device.serial()}`);

  await device.shell('am force-stop org.chromium.webview_shell');
  await device.shell('am start org.chromium.webview_shell/.WebViewBrowserActivity');

  const webview = await device.webView({ pkg: 'org.chromium.webview_shell' });
  const page = await webview.page();

  await device.fill({ res: 'org.chromium.webview_shell:id/url_field' }, 'github.com/microsoft/playwright');
  await Promise.all([
    page.waitForNavigation(),
    device.press({ res: 'org.chromium.webview_shell:id/url_field' }, 'Enter')
  ]);
  console.log(await page.title());

  {
    const context = await device.launchBrowser();
    const [page] = context.pages();
    await page.goto('https://webkit.org/');
    console.log(await page.evaluate(() => window.location.href));
    await context.close();
  }

  await device.close();
})();

Readme

Keywords

none

Package Sidebar

Install

npm i playwright-android

Weekly Downloads

4

Version

0.0.8

License

Apache-2.0

Unpacked Size

22.1 MB

Total Files

186

Last publish

Collaborators

  • mxschmitt
  • pavelfeldman