Skip to content

playwright

62,856 19 698 Apache-2.0
1.44.1 (8 Jun 2024) Jan 23 2015 23.6 million (month)

Playwright is a Node.js library that provides a high-level API to automate web browsers. It allows you to automate browser tasks such as generating screenshots, creating PDFs, and testing web pages by simulating user interactions. Playwright is similar to Puppeteer, but it supports more browsers and it also provide capabilities for automation of browser like Microsoft Edge and Safari.

Playwright is commonly used for web scraping, end-to-end testing, and browser automation.
Playwright is a spiritual successor to Puppeter and is available in more languages and has access to more browser types.

Example Use


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

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('https://www.example.com/form');

    // fill in the form
    await page.fill('input[name="name"]', 'John Doe');
    await page.fill('input[name="email"]', 'johndoe@example.com');
    await page.selectOption('select[name="country"]', 'US');

    // submit the form
    await page.click('button[type="submit"]');

    // wait for the page to load after the form is submitted
    await page.waitForNavigation();

    // take a screenshot
    await page.screenshot({path: 'form-submission.png'});

    await browser.close();
})();

Alternatives / Similar


Other Languages

11,134 1.45.0 (12 days ago) Feb 24 2021 compare
29,780 4.22.0 (24 days ago) Apr 25 2008 compare
9,064 3.5.5 (4 months ago) Sep 04 2020 compare
1,823 0.4.0 (5 months ago) Dec 28 2012 compare
10,591 chromedp (11 months ago) Aug 15 2019 compare
2,907 v2.1.1 (7 months ago) Jul 17 2018 compare
411 1.9.3.1 (a month ago) Jul 22 2022 compare
4,039 3.5 (4 years ago) Apr 25 2014 compare
Was this page helpful?