Socket
Socket
Sign inDemoInstall

playwright-chromium

Package Overview
Dependencies
Maintainers
6
Versions
4522
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

playwright-chromium

A high-level API to automate Chromium


Version published
Weekly downloads
141K
increased by12.4%
Maintainers
6
Weekly downloads
 
Created

What is playwright-chromium?

The playwright-chromium npm package is a Node library that provides a high-level API to automate Chromium-based browsers. It is part of the Playwright project, which is designed for end-to-end testing and web scraping. The package allows you to control a browser, navigate web pages, interact with elements, and capture screenshots, among other functionalities.

What are playwright-chromium's main functionalities?

Browser Automation

This feature allows you to automate browser actions such as navigating to a URL, taking screenshots, and closing the browser.

const { chromium } = require('playwright-chromium');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'example.png' });
  await browser.close();
})();

Web Scraping

This feature allows you to scrape data from web pages by navigating to a URL and extracting information using DOM selectors.

const { chromium } = require('playwright-chromium');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  const data = await page.evaluate(() => document.querySelector('h1').innerText);
  console.log(data);
  await browser.close();
})();

Form Submission

This feature allows you to automate form submissions by filling out input fields and clicking buttons.

const { chromium } = require('playwright-chromium');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com/login');
  await page.fill('#username', 'myUsername');
  await page.fill('#password', 'myPassword');
  await page.click('button[type="submit"]');
  await browser.close();
})();

Testing

This feature allows you to perform end-to-end testing by navigating to a URL, performing actions, and making assertions.

const { chromium } = require('playwright-chromium');
(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  const title = await page.title();
  console.assert(title === 'Example Domain', 'Title is incorrect');
  await browser.close();
})();

Other packages similar to playwright-chromium

FAQs

Package last updated on 10 Feb 2021

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