Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

playwright-android

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-android

A high-level API to automate Chrome for Android

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

playwright-android

This package contains the Android flavor of Playwright.

Requirements

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 demo

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

(async () => {
  const [device] = await android.devices();

  // Android automation.
  console.log(`Model: ${device.model()}`);
  console.log(`Serial: ${device.serial()}`);

  await device.tap({ desc: 'Home' });
  console.log(await device.info({ text: 'Chrome' }));
  await device.tap({ text: 'Chrome' });
  await device.fill({ res: 'com.android.chrome:id/url_bar' }, 'www.chromium.org');
  await device.input.press('Enter');
  await new Promise(f => setTimeout(f, 1000));

  await device.tap({ res: 'com.android.chrome:id/tab_switcher_button' });
  await device.tap({ desc: 'More options' });
  await device.tap({ desc: 'Close all tabs' });

  // Browser automation.
  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();
})();

FAQs

Package last updated on 09 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc