Skip to content

playwright

65,471 22 646 Apache-2.0
1.47.0 (7 Sep 2024) Jan 23 2015 28.7 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,476 1.46.0 (29 days ago) Feb 24 2021 compare
30,163 4.24.0 (13 days ago) Apr 25 2008 compare
9,539 3.5.5 (6 months ago) Sep 04 2020 compare
10,820 chromedp (1 year, 1 month ago) Aug 15 2019 compare
1,830 0.4.0 (7 months ago) Dec 28 2012 compare
510 1.9.3.1 (3 months ago) Jul 22 2022 compare
2,928 v2.1.1 (9 months ago) Jul 17 2018 compare
4,063 3.5 (4 years ago) Apr 25 2014 compare
Was this page helpful?